Page 1 of 1

[Solved] Disable button on mainform

PostPosted: Wed Oct 16, 2019 4:16 am
by gkick
Hi,

anyone having an example of toggling a buttons enabled and or visible property
Thanks

Re: Disable button on mainform

PostPosted: Wed Oct 16, 2019 5:27 pm
by UnklDonald418
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

[Solved]Re: Disable button on mainform

PostPosted: Thu Oct 17, 2019 4:45 am
by gkick
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