[Solved] Disable button on mainform

Creating and using forms

[Solved] Disable button on mainform

Postby gkick » Wed Oct 16, 2019 4:16 am

Hi,

anyone having an example of toggling a buttons enabled and or visible property
Thanks
Last edited by gkick on Thu Oct 17, 2019 4:46 am, edited 1 time in total.
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 238
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Disable button on mainform

Postby UnklDonald418 » Wed Oct 16, 2019 5:27 pm

Your macro must first find the oForm object, and that depends on the structure of the form and how the macro is triggered. Once you have the oForm object then to toggle the Enabled property use
Code: Select all   Expand viewCollapse view
oButton = oForm.getByName("NameOfTargetButton")

If oButton.Enabled = TRUE then
   oButton.Enabled = FALSE
Else
   oButton.Enabled = TRUE
End if


or if you want to toggle visibility use

Code: Select all   Expand viewCollapse view
oButton = oForm.getByName("NameOfTargetButton")

If oButton.EnableVisible = TRUE then
   oButton.EnableVisible = FALSE
Else
   oButton.EnableVisible = TRUE
End if
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1307
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

[Solved]Re: Disable button on mainform

Postby gkick » Thu Oct 17, 2019 4:45 am

Thank you UnclDonald ! Had the first piece of code working and the button came back at restarting base. Appreciate your time and help
regards
Gerhard
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 238
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile


Return to Forms

Who is online

Users browsing this forum: No registered users and 2 guests