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

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.

@doug Did you ever find a solution or a workaround to this ?

@gkick I didn’t find a workaround and don’t quickly see one now. Here are some links to potentially relevant parts of the documentation, for follow-up: [1], [2], [3]

@doug Thanks for the links, much appreciated

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

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

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.

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

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”)

Hi,

possibly of relevance to Windows Users.

After searching for an answer for some time it appears there are only limited options available in LO

Go Full Screen mode - but how would you block the user leaving full screen ?

or create an event handler to cancel the close event which takes considerable programing experience

or use an external tool like NoClose

works on my Windows10 and maybe useful if you only want to block yourself from the close button as the app sits in
the tray and can be easily turned off.

or

SendMessage.exe: Access to advanced Windows features - DosTips.com for those who know DOS batchfiles and call the script via shell (have not got this to work yet)

Ultimately there is some workaround by using a forms on View is going to be closed event as demonstrated in the mockup.

The attached mockup illustrates some work around based on an idea of F3Ktotal
https://forum.openoffice.org/en/forum/viewtopic.php?f=39&t=58393&p=258547&hilit=remove+button&sid=277c1e940eb53ec2d308aa79cb8e6653#p258547

works well if there are no recursive calls like jumping between forms instead of always returning to the menu which is the only point to terminate killing the process hence not a viable solution to more complex systems.

MockUp.odb

@Doug (a few years after the question)
Got this from a German gentleman on the DOS forum, works in Win 10
playpen.odb