Ask Your Question

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

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

doug gravatar image

updated 2020-08-22 20:40:09 +0100

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?


edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2020-07-21 06:30:23.219163

1 Answer

Sort by » oldest newest most voted

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

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


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 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 +0100 )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 +0100 )edit

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

Lovro gravatar imageLovro ( 2018-02-07 16:05:04 +0100 )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 +0100 )edit

Question Tools

1 follower


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

Seen: 894 times

Last updated: Jul 02 '15