25.6.3 The Button Settings Dialog Box


The Button Settings Dialog Box.png

The File Name Text Box

Specify the LabTalk script file that contains the script for this button. You can specify a built-in script file or a custom script file that you or another Origin user created. Script files have the file name extension .OGS.

The script file is a text file that is organized in sections. Each of these sections is identified by the name of the section, surrounded by square brackets. This is a section from one of the .OGS files that is installed with your Origin software.

// Filename:  Arrow.ogs

// Creation:  10/31/1996

// Purpose:  Script to be called from the Arrow toolbar

//////////////////////////////////////////////////////////////////

[Horizontal]

select -toggle horz;

[Vertical]

select -toggle vert;

Note: To view an example LabTalk script file:

  1. Select File: Open.
  2. Select LabTalk Script (*.OGS) from the Files of Type drop-down list.
  3. Select a script file.
  4. Click Open.

For example, select ARROW.OGS. The script file opens in a LabTalk Editor window.

The Section Name Text Box

Specify the script file section name (without brackets) that contains the script for this button in the Section Name text box.

In the script file, section names are enclosed in brackets. For example:

 [SectionName]

The Argument List Text Box

To pass the script file section an argument (or arguments), type the argument(s) in the Argument List text box.

Up to five arguments may be passed and must be space separated. Protect spaces within an argument with cotes or parentheses. All arguments are passed as text with any text substitution occurring before being passed to the script:

Example ( Assume %A = "myvar" and myvar = 3 ) :

"one is the first" %A $(%A) $(pi) (five is the fifth argument)

gets passed the script as these five text strings :

"one is the first" "myvar" "3" "3.14159" "five is the fifth argument"

The Tool Tip Text and Status Bar Text Boxes

Specify the ToolTip and status bar messages for the button in the respective text boxes.

The Context Group

You can restrict the button's availability to instances when a window created from a particular template is active, or when a specific window type is active. Furthermore, you can restrict the button's availability based on the value of a specified variable. To restrict a button's availability based on a variable value, type the variable name or a test condition in the LabTalk Expression to enable text box (see the following example).

To determine the button's availability, Origin first checks the template and window type restrictions. If the button passes this criteria, Origin then checks to see if a variable (or object property) has been associated with the button.

If you entered a variable name in the Expression text box, Origin then checks the current numeric value of the variable. If the current variable value is zero, Origin disables the button. Otherwise, Origin enables the button. For example, if you enter wks.sel in the Expression text box, then whenever there is a selection in the worksheet, wks.sel would be non-zero, and the button would be enabled.

If you entered a test condition in the Expression text box, Origin then checks to see if the test condition is False (zero) or True (non-zero). If the test condition is False, Origin disables the button. If the test condition is True, Origin enables the button. For example, if you entered ...

wks.sel == 8

... then whenever a range of data is selected in the worksheet, this condition would be True and the button would be enabled.

You can also change the state of the button to let it show different icons by "LabTalk Variable to toggle" text box. For example, if you entered ...

state:3

... then the icon image will use itself and another two following in the bitmap based on the value of LabTalk variable state rounded by 3.

Or in special cases, if you entered ...

state:1 or state

... then it means the button will be toggled between states that is pressed-down or not pressed-down.

Note that the button will be disabled if LabTalk variable state is not defined or contains missing value, and the toggle variable will be passed as an extra argument at the end of argument list internally.