I am rebuilding a DB I had in Access onto LO Base. I have learned a lot, but my search for making all objects within a group invisible by the click of a button have come up empty. The most I have learned is that it is possible.
In my testing, I have made a macro that makes invisible all types of objects; and it works.
I have grouped them all together and named the group grpDataEntry
Can anyone tell me how to alter this macro in order to make all objects in the group vanish?
Much appreciated:
Group name: grpDataEntry
Button Name: PushButton
Macro
Code: Select all
Sub Main
Dim Doc As Object
Dim Form As Object
Dim Button As Object
Dim ButtonCtrl As Object
Dim TextBox As Object
Dim TextBoxCtrl As Object
' Get the current document
Doc = ThisComponent
' Get the form from the document
Form = Doc.DrawPage.Forms.getByIndex(0)
' Get the button from the form
Button = Form.getByName("PushButton")
' Get the button control
ButtonCtrl = Doc.CurrentController.getControl(Button)
' Get the text box from the form
TextBox1 = Form.getByName("Text Box 1")
TextBox2 = Form.getByName("Text Box 2")
CheckBox1 = Form.getByName("Check Box 1")
FromattedBox1 = Form.getByName("Formatted Field 1")
Option1 = Form.getByName("Option Button 1")
ListBox1 = Form.getByName("List Box 1")
ComboBox1 = Form.getByName("Combo Box 1")
LabelBox1 = Form.getByName("Label Field 1")
' Get the text box control
TextBoxCtrl = Doc.CurrentController.getControl(TextBox1)
TextBoxCtrl2 = Doc.CurrentController.getControl(TextBox2)
CheckBoxCtrl = Doc.CurrentController.getControl(CheckBox1)
FromattedBoxCtrl = Doc.CurrentController.getControl(FromattedBox1)
OptionCtrl = Doc.CurrentController.getControl(Option1)
ListBoxCtrl = Doc.CurrentController.getControl(ListBox1)
ComboBoxCtrl = Doc.CurrentController.getControl(ComboBox1)
LabelBoxCtrl = Doc.CurrentController.getControl(LabelBox1)
' Hide the text box
TextBoxCtrl.setVisible(False)
TextBoxCtrl2.setVisible(False)
CheckBoxCtrl.setVisible(False)
FromattedBoxCtrl.setVisible(False)
OptionCtrl.setVisible(False)
ListBoxCtrl.setVisible(False)
ComboBoxCtrl.setVisible(False)
LabelBoxCtrl.setVisible(False)
End Sub