Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

ORG-11096

A Toggle Button displays checked/unchecked states as a button


 

Origin 2015 support add an text box named "labtalk Variable to toggle" in the Button Settings dialog.The variable can be pass to script file.

 

How to

  1. Open the Customize Toolbar dialog box (View:Toolbars) and select the Button Groups tab.
  2. Select the User Defined button group from the Groups list.
  3. Select a button in the Buttons group.
  4. Click on the Settings button in the Button group. This opens the Button Settings dialog box.

          

Labtalk Variable
Description
state:1 or statebutton will be toggled between states that is pressed-down or not pressed-down
state:2,state:3,etcbutton has 2/3 states, icon image will use itself by default and another one/two following in the bitmap

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

Examples:

    1.press down/up states


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

///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.

[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.

2.d Run "state=0;" in script window, button is enable now, click it, button icon become the next button icon in the bitmap.

  • No labels