在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
On our main data entry screen, we have an OK/Cancel dialog in the OnBeforePost event.
Which does what it's meant to, roll back any changes and puts the dataset into browse mode. This is fine for most of the clients, but we have been asked if it can be changed to
If they want to cancel, they can use the cancel button. Looking at the source for procedure TDataSet.Post; it does not look possible to use the event this way. Dose anyone have any thoughts on a way this could be done? Follow Up: this is how I have chosen to handle it now case MessageDlg('Save Changes?', mtWarning, [mbYes, mbNo, mbAbort], 0) of mrYes: ; mrNo: Dataset.Cancel; mrAbort: Abort; mrNone: Abort; end; Calling the method Abort (from the unit System, if I recall correctly) raises a silent EAbort exception, which cancels just the current operation. That should work. (Btw: this method of cancelling a databaset operation is also described somewhere deep in the help system as the 'normal' way to achieve this --- that's where I got this technique from originally). 在主数据输入屏幕上,OnBeforePost事件中有一个OK / Cancel对话框。
这是什么意思,回滚任何更改并将数据集置于浏览模式。 这对大多数客户来说都不错,但是我们被问及是否可以更改为
如果他们想取消,他们可以使用取消按钮。 查看源代码程序TDataSet.Post; 它看起来不可能使用 任何人都有任何想法可以做到这一点吗? 跟进:这是我现在如何选择处理它 case MessageDlg('保存C挂起?',mtWarning,[mbYes,mbNo,mbAbort],0) 解决方案
调用方法 / code>(从单元 System ,如果我记得正确)引发了一个静默的 EAbort 异常,仅取消当前操作。 (btw:这种取消数据库操作的方法也在帮助系统深处被描述为"正常"的方式来实现这一点---这是我从最初得到这种技术的地方)。 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论