Download Origin 5 LabTalk Developer`s Guide
Transcript
Chapter 2, Advanced Origin In addition to reading this property value, you can also directly change the property value in the Script window. To move the right edge of the bottom X axis title to X=5, type the following in the Script window: xb.x=5 (ENTER) The right edge of the bottom X axis title is now aligned with the line X=5. The text that displays in the bottom X axis title is controlled by the xb object's text$ string property. The following script assigns the current string constant of the text$ property to a string variable, displays this string constant in an Attention dialog box, and then assigns a new string constant to the text$ property (which displays in the bottom X axis title). To run this script from the Script window, type in each line of code including the semicolon at the end of each line. Then highlight the three lines of code and press ENTER. %A=xb.text$; type "The object's text is %A"; xb.text$=New Text Here!; In general, any option that can be controlled in the Origin window object’s associated dialog box can also be set using the appropriate LabTalk object property. For attributes that are controlled from a combination box or drop-down list value in a dialog box, you can usually set the object property to the associated entry number in the dialog box list. Object Methods Objects can also perform actions including running their script, redrawing themselves, or simulating a click on themselves. Since these actions are directly linked for a particular object, the actions are referred to as object methods. When using object methods in your scripts, make sure you don't include a space between the method name and the opening parenthesis. 26 • 2.1 Overview of Origin Object methods use the following syntax: ObjectName.MethodName(Argument1, ... , Argumentn); Some object methods take no arguments. Thus, nothing appears within the parentheses. However, even when the method has no arguments, the parentheses must still be included. The parentheses indicate that MethodName is a method of the ObjectName object - not a property.