Ask Your Question
0

Base: is there a way to disable the close button on a form?

asked 2015-07-02 05:08:59 +0200

doug gravatar image

updated 2015-08-24 23:57:02 +0200

Alex Kemp gravatar image

I would like to remove the close button on the window of a Base Form. This was trivial in the other desktop database solution, having trouble figuring it out here. When I close a form I want to be sure to run a macro, but unfortunately none of the Form events in LO appear to be triggered when you hit the close button in the window. Thus, I would like to disable the close button, which in the other desktop database solution was known as the ControlBox I think. Using Windows 7, LO 4.4.

I know how to call the Form window object, but I cannot see the option to disable the ControlBox CloseButton or anything like that. Here is the hierarchy to call the Form Window:

rootDoc = ThisComponent.parent
ctrllr = rootDoc.getCurrentController
fr = ctrllr.Frame
cmpt = fr.ContainerWindow

I cannot see an appropriate property or method using dbg_methods or dbg_properties.

Does anyone know how to disable the Close button?

Thx.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2015-07-02 13:18:35 +0200

peterwt gravatar image

The Form events are Form Load and Form Unload - equivalent to Form Open and Form Close in other database applications.

edit flag offensive delete link more

Comments

I have Before Unloading and When Unloading but neither are triggered when I use the close button, both in Linux and Windows, using LO rc 5.0.0.1 and 4.4. That was the first thing I tried; test MsgBox does not appear. There is a document-level event that could be triggered on all subcomponent opens and closes, but that would be complicated. As an aside, the load event also does not seem to be triggered unless there is a recordet in the form, which adds another layer for switchboard forms

doug gravatar imagedoug ( 2015-07-02 16:47:55 +0200 )edit

Tried some tests and it does appear that Base is deficient in a number of areas. Help states :-

"The Before unloading event occurs before the form is unloaded; that is, separated from its data source."

"The When unloading event occurs directly after the form has been unloaded; that is, separated from its data source."

Neither work even with recordset in Form. In MS Access Form property has disable close button on Form and plenty of events including FormOpen/Close without record set.

peterwt gravatar imagepeterwt ( 2015-07-04 16:58:30 +0200 )edit

Unloading event do not work for me either. I think it is a bug

Lovro gravatar imageLovro ( 2018-02-07 16:05:04 +0200 )edit

Before Unloading and When Unloading are events of the included "form". This has nothing to do with the "Window". Window events are accessed trough the menu Tools->Customize and then the Events Tab, and are Open Document and View is going to be closed. Generally the Form events in LO refer to forms and subForms included in the Window (which is known as Form in the "other database application")

Xoristzatziki gravatar imageXoristzatziki ( 2018-05-12 14:02:55 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-02 05:08:59 +0200

Seen: 749 times

Last updated: Jul 02 '15