Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note:button will be disable if LabTalk variable is not defined or contains missing value

Examples:

press down/up states


1.a. Create a ogs file and save with follow script as toggle button.ogs.

Code Block
///Defind labtalk variable as myVar
if(myVar)
    type -b "button is pressing up"; 
 else
    type -b "button is pressing down";

1.b Open button settings dialog,Click browse button,browse and select toggle button.ogs as File Name.

1.c Fill State:1 in Labtalk Variable to toggle.close dialog,drag button to origin workspace.

1.d Run "int myVar;" in script window, button is enable now, click it, button is press down.

    2. Multiple states

2.a Create a ogs file and save with follow script as toggle button_1.ogs.

Code Block
[Main]
switch (state)
{
    case 0:
        run.section(,State0);
        break;
    case 1:
        run.section(,State1); 
        break;
    case 2:
        run.section(,State2); 
        break;
}
[State0]
ty -b "toggle button to 2nd state".
[State1]
ty -b "toggle button to 3rd state".
[State2]
ty -b "toggle button to 1st state".

2.b Open button settings dialog,Click browse button,browse and select toggle button_1.ogs as File Name.

2.c Fill State:1 in Labtalk Variable to toggle.close dialog,drag button to origin workspace.
1.d Run "state=0;" in script window, button is enable now, click it, button icon become the next button icon in the bitmap.