override deal with window closing in database…

2008-04-10 02:57:17来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

In the database application development, the programmer should often deal with one thing that is when the user close a window (called Form in Delphi) where data was maintained, the program should judge whether the data was changed without saving and warn the user about this case. Almost all the programmer can deal with this easily, and the code is very simple as we know. The following code (written in Delphi 6) is the normal method to deal with the problem. It is base on one table maintenance and there are a DBGrid (named DBGRid) which shows the data of the table, a DBEdit (named DBEditName) which can be used to edit the data of the table and six Buttons (respective named BtnAdd, BtnModify, BtnDelete, BtnSave, BtnCancle, BtnClose). The last button is used to close the Form and the others are dealing with the data. I think their name show their function clearly and no explanation is given here.

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls, Buttons, Grids, DBGrids;

type

TForm1 = class(TForm)

BtnModify: TBitBtn;

BtnCancel: TBitBtn;

BtnAdd: TBitBtn;

BtnDelete: TBitBtn;

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Sender 的應用:所有Edit共用一個過濾格式

下一篇:windows API 函数 ShellExecute 的多种用法