2017-04-22 15:39:42, In: Hack, Database
Recently I was developing a simple database application in LibreOffice Base version 4.x. This is quite slow tool, but with a few modifications and tricks complex applications can be made.
Usually, database application consists of several forms supporting several tables opened from each other or common "switchboard" form. The problem in LibreOffice base is that it is not possible to easily make the "switchboard" form with buttons launching forms for other tables. There is no "macro wizard" to make it easily and most existing databases use extensions or hard-coded macros for it.
Officially, the only way to do it is by using Switchboard extension which is not much supported in later versions. Another way is to create macros for buttons. If you have 10 buttons opening 10 forms, you will have to make 10 macros connected to them, opening different forms. As in pure Open-Source programs, the only documentation is source code. Let's do it in more universal way: I inserted a target form name in ToolTip property of each button and each button was connected to single macro:
Sub Switchboard (oEvent as Object) sFormName=oEvent.Source.AccessibleContext.ToolTipText ThisDatabaseDocument.FormDocuments.getbyname(sFormName).open() End Sub