How To | Make a button disappear using Lua scripting
Learn how to use Lua scripting to make a button disappear from a page or application.
If you are not finding the results you need and still have questions, submit a request using the form below and our Tech Docs team will get right on it. Our goal is to provide the content you need!
Your engagement helps us create the content you need. Click here to review this article.
Table of Contents
The Component.New() method allows you to gain control over any object in a component, as long as that component has a “pretty name” (i.e., is a named component). This is very useful if you want to change something on the fly without compiling.
- Drag a scripting component into the design.
- Drag a Custom Controls component into the design and give it a name. (Select the component and type a name - in this example, "Test".)
- Set the custom control to Momentary and drag it into the design.
- Open the script editor. Copy this code snippet into your script:
- Component.New("Test").momentary_1.IsDisabled = true
- Click the yellow tab to save, and then press F6 to emulate the design. You will see the button gray out and become inactive.
- Now, change to this code:
- Component.New("Test").momentary_1.IsInvisible = true
- Save and press F6 to emulate. You should see the button go invisible, which disables it as well.