Page 1 of 1

[Solved] Trap dialog close event or remove close button

PostPosted: Sun Jul 20, 2008 10:38 pm
by grnhorn
How can a dialog close event be captured or the close button removed from the top of the dialog frame? The ultimate goal is to have an open document to close when the dialog does to prevent access to document by the user.

Thanks...

Re: Trap dialog close event or remove close button

PostPosted: Mon Jul 21, 2008 4:12 pm
by Villeroy
Method execute() returns 0 if the dialog has been canceled. I just posted an example with FilePickers: viewtopic.php?f=20&p=37713#p37713

Re: Trap dialog close event or remove close button

PostPosted: Mon Jul 21, 2008 4:49 pm
by grnhorn
Thanks Villeroy, but I guess I have left you hanging on what I am looking for. I want to trap the exit code for a dialog created in BASIC so that it will close the document. Or I want to remove the system close button so that I can add my own to close the doc to prevent the user from having access to the system commands.

Thanks...

Re: Trap dialog close event or remove close button

PostPosted: Mon Jul 21, 2008 5:49 pm
by Villeroy
You can not remove the close button from the window title. This is under the control of the respective window system.
This scheme always woks for me:
Code: Select all   Expand viewCollapse view
iResult = myDialog.execute()
If iResult = 1 then
  do_Stuff(args)
Else
  do_SomemethingElse()
End If

Don't accept Cancel or window's [X]-button:
Code: Select all   Expand viewCollapse view
do while iResult = 0
  iResult = myDialog.execute()
  If iResult = 1 then do_Stuff(args)
Loop


If you need anything more sophisticated, go ahead, install the Xray Tool and set up all the listeners you need.