procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  if Table1.State in [dsInsert,dsEdit]  then
    //未保存
    CanClose := false;
end;
—————————————————————————————————
MaximStr := '宠辱不惊,看庭前花开花落,去留无意;
             毁誉由人,望天上云卷云舒,聚散任风。';
if Not Assigned(I) then
  I := TI.Create(Nil);
I.Maxim := MaximStr;
I.Explain := '可用分不够可以给我发短消息';
I.Desire := '加不加分随你';
—————————————————————————————————
    

解决方案 »

  1.   

    在form的OnCloseQuery事件中加入如下代码:
    procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    begin
      if (Table1.State in [dsInsert,dsEdit]) or(其他条件)then
       begin
        if MessageDlg('你修改的数据未存盘,要存盘                    吗?',mtConfirmation,[mbYes,mbNo],0)=mrNo then exit
         else 
        CanClose := false;
       end;
    end;
      

  2.   

    If you are using TClientDataSet, you can check its ChangedCount property. If it is not zero, the CDS is not saved yet.
      

  3.   

    我觉得还是lxpbuaa(桂枝香在故国晚秋)的好。
      

  4.   

    我也认为ryuxy(瀟湘酷雨) 的要好一些,用户界面更加友好一些!