EasyManua.ls Logo

Topcon OPUS A6G2 - How to Create Switch Buttons with Changing Colors; How to Use One Script for Several Buttons; How to Create a Drop down Menu

Topcon OPUS A6G2
800 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
744
OPUS Projektor Manual
How To
12
How To
Here you will find some quick short solutions for common use cases. Feel free to contact us if
something you think should be there is missing.
12.1
How to create switch buttons with changing colors
You want to create buttons that activate and deactivate certain settings (like a switch). The
background color of the button should indicate if the setting is activated or not.
·
Create a button object
·
Set the property Latching to true
·
If applicable, put a String Field or a Picture Graphic object into the button (set them to
transparent to still see the button background)
·
Put a script with the following code into the OnPress event of the button:
setProperty(<button_ID>, "Background Color", <"pressed" color
in [r,g,b,a] array format>);
·
Put a script with the following code into the OnRelease event of the button:
setProperty(<button_ID>, "Background Color", <"released" color
in [r,g,b,a] array format>);
If the button background color shouldn't change directly when the button is pressed but instead
after a confirmation message from the CAN bus, put the script on the
OnValueChangeByOwner event of the related variable.
12.2
How to use one script for several buttons
You want to have a set of buttons that should basically perform a similar action, but a bit
different depending on which of the buttons has been pressed.
·
Create some buttons
·
Create a variable "button_id"
·
On the OnPress event of each button, set the variable button_id to a certain value (e.g. on
button 1 to 1, on button 2 to 2 and so on)
·
Create one JavaScript
·
Put the script file on the OnRelease event of each button
·
In the script use a switch-case statement to differentiate what should happen with which
button
New since version 2019 of the program:
We have a function called GetCallerID now which tells you in a script from which object the
script was executed. So alternatively to the solution above this function could be used in a
generic script to find out which button was being pressed.
12.3
How to create a drop down menu
You want to create a drop down menu where the user can select one of several options.
·
Create a list object
·
Reference a variable menu_id with the list object
·
Put e.g. 10 String Fields (or images) into the list object (every object is one option in the
menu)
552

Table of Contents