PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: wm_close  (Read 449 times)

tom cone jr

  • Guest
wm_close
« on: November 12, 2005, 10:03:46 PM »

The help file emphasizes the importance of closing forms correctly.

Quote
To destroy the Form (a process called "unloading" in Visual Basic), you need to use the FireFly internal FF_CloseForm function. You need to use this function rather than the Windows SDK DestroyWindow because FireFly needs to reset various variables to ensure that modal and modeless windows are handled correctly.


So, does this mean I have to put FF_CloseForm() in the wm_close event for each form?

Does this mean that if the user closes the form with the System Menu 'X' that FF_CloseForm will not be called?  (i.e.  unless I add it somewhere in each form)

Thanks.

-- tom
Logged

TechSupport

  • Guest
wm_close
« Reply #1 on: November 13, 2005, 12:12:44 PM »

Hi Tom,

Good question. You do not have to put FF_CLOSEFORM in the WM_CLOSE message handler or when the "X" is pressed. Looking at the FireFly generated code shows that FireFly handles those situations internally and resets the proper code when WM_CLOSE or "X" is fired.

The documentation specifically addresses the situation where the user calls the DestroyWindow API (or the DDT's equivalent, DIALOG END). FF_CloseForm specifically adds code that resets certain variables and enables sets the active window.
Logged

Roger Garstang

  • Guest
wm_close
« Reply #2 on: November 13, 2005, 07:01:21 PM »

And to address another possible question...FF generated code also routes all possible ways of closing the form through WM_CLOSE so it is always handled properly...one of my favorites since I just have to handle one message for "Are You Sure?" message boxes, etc.
Logged

tom cone jr

  • Guest
Wm_close - prevent form closing
« Reply #3 on: November 13, 2005, 11:10:26 PM »

Roger, thanks.  Is this how you would block the user from closing a form if, for example, some text values have changed on form, but have not yet been written to disk?  i.e.  use the wm_close message to determine if closing the form is ok?

-- tom
Logged

Roger Garstang

  • Guest
wm_close
« Reply #4 on: November 13, 2005, 11:21:22 PM »

Yes, return 1/TRUE to cancel the close.  Only way to close then without clicking to on the prompt is End Task.
Logged

tom cone jr

  • Guest
wm_close
« Reply #5 on: November 14, 2005, 07:27:59 AM »

Roger, thanks again.   -- tom
Logged