Newbie: Saving DB info when windows closes!! 
Author Message
 Newbie: Saving DB info when windows closes!!

Using: delphi 1, single user app using local Paradox thru IDAPI, TDatabase

The system I'm building is for real newbies -- they'll often close
windows without closing my app.  

So all DB inserts/changes are lost...
Very Bad...

I threw in this:

procedure Tf_Main.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  if not permitclose then
    messagedlg('Your Custom Application is still running!'+#10#13+      
      'Please exit before closing windows.',      
    CanClose := false;  

(I set permitclose to true if the exit button is pressed.)

Problem: focus is on main form even if the app has a modal form.
(Having a form highlighted when you can't do a thing with it is
very bizarre...)

Is there a way to tell which (If any) of my apps forms is modal,
and focus on that one?

Is there a way to save all database changes before the app closes?
I do have posts, uh, all over, all ready, but the changes don't
seem to be permanent outside of my app (ie app destroyed = changes lost)

I tried adding a Database.close in the main form's destroy event,
but it didn't seem to work...

So is there a way to do that?

Many thanks,

Norman Lange    |
Toronto, Canada | Just a little bit of knowledge is a scary thing...

Sun, 04 Oct 1998 03:00:00 GMT  
 Newbie: Saving DB info when windows closes!!


> Is there a way to save all database changes before the app closes?


Have you tried something like this.  It seems to work for me (or at
least I hope it does...)  It goes in the main form's Close event:

  if (Table1.State = dsEdit) then

Of course, you'll need to do one of the above for each table that can be



Mon, 05 Oct 1998 03:00:00 GMT  
 Newbie: Saving DB info when windows closes!!
attach the following code to the Application.OnIdle event


One that is more reliable is DbiSaveChanges(TTable.Handle), to be applied
to all tables on all forms.

Check this message for more info. LOSING PARADOX/DBASE DATA???

Tue, 06 Oct 1998 03:00:00 GMT  
 [ 3 post ] 

 Relevant Pages 

1. closing a Window with Pascal for Windows

2. Save changes to disk whithout close the table.

3. Saving variable info

4. Newbie Looking for info on D2 Database development

5. Newbie ODBC + mODBC + info

6. Opening and Closing speed of DB

7. Pascal newbie requires info

8. Newbie Info

9. Newbie needs some info

10. File Filtering Info request - newbie help

11. Closing / Freeing DB & Memory Crashes

12. Closing windows when executing another pascal program win1.5


Powered by phpBB® Forum Software