[Solved] Trap dialog close event or remove close button

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
grnhorn
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

[Solved] Trap dialog close event or remove close button

Post 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...
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
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Trap dialog close event or remove close button

Post by Villeroy »

Method execute() returns 0 if the dialog has been canceled. I just posted an example with FilePickers: http://user.services.openoffice.org/en/ ... 713#p37713
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
grnhorn
Posts: 32
Joined: Sun Jul 13, 2008 2:07 pm

Re: Trap dialog close event or remove close button

Post 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...
OOo 2.4.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Trap dialog close event or remove close button

Post 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

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

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 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply