The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

System menu close box

  • Filter
  • Time
  • Show
Clear All
new posts

  • System menu close box

    Is there any easy way to distinguish when a user clicks the system menu close box (the X in top right of a dialog) versus a DIALOG END hDlg, 0?


    Bernard Ertl
    Bernard Ertl
    InterPlan Systems

  • #2
    When a dialog is instructed to close, the Callback Function gets a %WM_SYSCOMMAND | %SC_CLOSE message. This occurs whether the dialog is closed via the System Menu, the Close box, or a DIALOG END statement.

    Therefore, if you want to distinguish between your own close routine (that uses DIALOG END) and the System Menu/Close selection, return an appropriate value with the user-defined parameter of the DIALOG END statement. This value is then passed to the calling code.

    Since the system Close menu item will close the dialog without regard to a return value, the dialog will return zero to the calling code.

    Therefore, detecting how the dialog was closed from within the _calling_ code is simply a matter of setting the return value in the callback, and checking the dialog return value.

    Clear as mud?

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]