Returned msg of closing dialog 
Author Message
 Returned msg of closing dialog

 Can't seem to find any soloution to pick up the 'event' of my dialog
getting closed from the system exit button on the right side. I've been
browsing for an hour in the help file, but can't find anything..

Why..? Because dialog data should be saved to file before the program
closes.



Sun, 21 Apr 2002 03:00:00 GMT  
 Returned msg of closing dialog
%WM_CLOSE
Quote:

> Can't seem to find any soloution to pick up the 'event' of my dialog
>getting closed from the system exit button on the right side. I've been
>browsing for an hour in the help file, but can't find anything..

>Why..? Because dialog data should be saved to file before the program
>closes.



Mon, 22 Apr 2002 03:00:00 GMT  
 Returned msg of closing dialog
Usually, the window procedure for the top level window will receive a
%WM_SYSCOMMAND message, with the %SC_CLOSE parameter.

In this event handler, you would normally call DestroyWindow(),
Finally, in the %WM_DESTROY event you would put a call to
PostQuitMessage().

If you are writing a DDT application, then you would normally just
drop out of the dialog by using DIALOG END (which will cause a
%WM_DESTROY event to occur).

For example (psuedo DDT app)...
CALLBACK FUNCTION DialogCallBack()
  SELECT CASE CBMSG          
    CASE %WM_SYSCOMMAND              
      IF CBWPARAM = %SC_CLOSE THEN
        ' save settings, and then...
        DIALOG END CBHNDL  ' triggers a %WM_DESTROY
      END IF
    CASE %WM_DESTROY
      ' Release all GDI and other objects used in this event.
  END SELECT
END FUNCTION

Quote:

> Can't seem to find any soloution to pick up the 'event' of my dialog
>getting closed from the system exit button on the right side. I've been
>browsing for an hour in the help file, but can't find anything..
>Why..? Because dialog data should be saved to file before the program
>closes.

Lance
powerbasic Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Mon, 22 Apr 2002 03:00:00 GMT  
 Returned msg of closing dialog

Quote:
>    CASE %WM_SYSCOMMAND
>      IF CBWPARAM = %SC_CLOSE THEN

This one put me right on the tracks again. I appreciate that.


Wed, 24 Apr 2002 03:00:00 GMT  
 Returned msg of closing dialog

Lance,

I don't think the DIALOG END CBHNDL is  needed.

To abort a closing you would return a non zero.

  IF CBWPARAM = %SC_CLOSE THEN
    IF MsgBox("Are You Sure You Want To Exit,%MB_YESNO,"Exit")=%IDNO THEN
      FUNCTION = 1
      EXIT FUNCTION
    END IF
  END IF

The problem I have had in converting standard SDK style to DDT is in SDK the
standard to close a dialog is to send it a %WM_CLOSE message. In the sdk you
are responsible for removing the dialog withing the %WM_CLOSE handler  with
EndDialog or DestroyWindow. By Not doing so your dialog closing is aborted.
This in effect handles both a user defined close event ( a menu exit or button
push ) and the WM_SYSCOMMOND -> SC_CLOSE event.

In DDT once you get to WM_CLOSE your are SOL. No way to abort, so you have to
have abort code in more than one place.

James

Quote:

>Usually, the window procedure for the top level window will receive a
>%WM_SYSCOMMAND message, with the %SC_CLOSE parameter.

>In this event handler, you would normally call DestroyWindow(),
>Finally, in the %WM_DESTROY event you would put a call to
>PostQuitMessage().

>If you are writing a DDT application, then you would normally just
>drop out of the dialog by using DIALOG END (which will cause a
>%WM_DESTROY event to occur).

>For example (psuedo DDT app)...
>CALLBACK FUNCTION DialogCallBack()
>  SELECT CASE CBMSG          
>    CASE %WM_SYSCOMMAND              
>      IF CBWPARAM = %SC_CLOSE THEN
>        ' save settings, and then...
>        DIALOG END CBHNDL  ' triggers a %WM_DESTROY
>      END IF
>    CASE %WM_DESTROY
>      ' Release all GDI and other objects used in this event.
>  END SELECT
>END FUNCTION


>> Can't seem to find any soloution to pick up the 'event' of my dialog
>>getting closed from the system exit button on the right side. I've been
>>browsing for an hour in the help file, but can't find anything..
>>Why..? Because dialog data should be saved to file before the program
>>closes.

>Lance
>PowerBASIC Support

>-------------------------------------------------------------------------
>PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
>316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com




Thu, 25 Apr 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. email: msg.add_payload not synonymous with msg.attach?

2. Menubar not refreshed when closing a modal dialog

3. Balloon help on LabelEntry visible after Dialog is closed

4. Open/close file dialog

5. dialog w/close only, Scriptics gossip

6. closing a dialog box

7. Closing a file before or after return?

8. Closing a spawned process seems not to return resources

9. close $pipe doesn't return non-zero exit status

10. close within fileevent does not return stderr of subprocess

11. Non-blocking close doesn't return immediately on command pipeline

12. Return values after closing window

 

 
Powered by phpBB® Forum Software