MDICHILD - New Data bPostEnd

MDICHILD - New Data bPostEnd

Postby nageswaragunupudi » Thu Mar 04, 2010 9:47 am

In case of Main Window or modal dialog, the code after 'ACTIVATE WINDOW/DIALOG' is executed after the window/dialog is closed. If we have browse in such a window or dialog, we can close the dbf table or recordset after the ACTIVATE command and this works fine.

But in case of MDICHILD windows, the code following the ACTIVATE command is executed immediately after activating the window and we can not release the resources or close the data table after ACTIVATE command.

Therefore, we write the clean up code like release of resources and closing data tables/recordset in the VALID clause of the Window. But this is not totally safe.

There is a very small time between the data is closed in the valid clause and the window and browse are closed. If for some reason the browse needs to be refreshed in that small gap of time runtime error occurs. This issue was discussed in the forums earlier but no satisfactory solution was found.

Now the new DATA bPostEnd of TMdiChild class provides a reliable solution to this problem.

Instead of closing the data ( partcularly recordset ) in the VALID clause, we can do that in the codeblock oWnd:bPostEnd.

Code: Select all  Expand view

oWnd:bPostEnd := { || oRs:Close() }
 


Postend block is guaranteed to execute after the browse and window are closed. For the same reason, we better do not refer to the internal data of the browse or window.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10627
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests

cron