Subject Re: [IBO] correct closing of MDI-children ?
Author Helen Borrie (TeamIBO)
At 09:15 PM 10-01-02 +0100, you wrote:
>I have a MDI-Application with a connection and transaction component on the
>MDI-parent form (tiCommited,Autocommit)
>on many MDI-child forms I use TIB_Query objects with the connection from the
>mainform. In the OnCreate-method I open the query. What happens when the
>user closes the form? Causes this a Commit (or Commitretaining) ?

For neatness and task isolation, it's a good idea to use a separate transaction object for each form or datamodule that acts as a data access container for the task.

>Should I write a OnClose event handler ?
>e.g TIB_Query.close or is it a good idea to do some transaction handling in
>such a handler perhaps start a new Trancaction

In the child form's Close event (or CloseQuery if you want the user to do any manual tidy-up before closing the form) you can check the state of the transaction and either fix any that are open through the procedure, or identify what needs doing and inform the user, or just call the transaction's Close method to have it close the datasets and roll back any unresolved work.

As for starting a new transaction, really just do this if you are controlling transactions explicitly and you actually *need* one.

regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at www.ibobjects.com