[Solved] Trap dialog close event or remove close button

Creating a macro - Writing a Script - Using the API

[Solved] Trap dialog close event or remove close button

Postby grnhorn » Sun Jul 20, 2008 10:38 pm

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...
Last edited by grnhorn on Mon Jul 21, 2008 11:54 pm, edited 1 time in total.
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: Trap dialog close event or remove close button

Postby Villeroy » Mon Jul 21, 2008 4:12 pm

Method execute() returns 0 if the dialog has been canceled. I just posted an example with FilePickers: viewtopic.php?f=20&p=37713#p37713
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26720
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Trap dialog close event or remove close button

Postby grnhorn » Mon Jul 21, 2008 4:49 pm

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...
OOo 2.4.X on Ms Windows XP
grnhorn
 
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: Trap dialog close event or remove close button

Postby Villeroy » Mon Jul 21, 2008 5:49 pm

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.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26720
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests