LabTalk:User created Visual Objects (Object)

From OriginLab Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 07:46, 22 January 2009 (edit)
Echo (Talk | contribs)

← Previous diff
Current revision (18:16, 3 February 2009) (edit) (undo)
Eparent (Talk | contribs)
(Replacing page with 'The contents of this page have been moved to: Graphic Objects')
 
(13 intermediate revisions not shown.)
Line 1: Line 1:
-Visual objects can also be created by the Origin user and placed in an Origin child window. These objects include labels, arrows, lines, and other user-created graphic elements. These objects are accessed from script by their name, as defined in the associated Label Control dialog box.+The contents of this page have been moved to:
-To open the Label Control dialog box:+[[LabTalk:Graphic_Objects|Graphic Objects]]
- +
-# Select Edit:Button Edit Mode to enter Button Edit Mode.+
-# Click on the object, then select <span class="hcp1">Format:Label Control</span>.+
-# Enter the desired name in the <span class="hcp1">Object Name</span> text box.+
-# Click <span class="hcp1">OK</span> to close the dialog box.+
- +
-Scripts can be attached to these labels by typing the script into the text box of the Label Control dialog box. The Script execution trigger is set from the <span class="hcp1">Script, Run After</span> drop down list.+
- +
-In general, only named objects can be accessed from LabTalk script. However, an unnamed object can be accessed by a script from within its own Label Control dialog box with '''this.''' notation, as described below.+
- +
-==Syntax of the user-created visual object properties==+
- +
-<lt>+
-[winName!]objName.property = value +
-</lt>+
- +
-or+
- +
-<lt>+
-this.''property'' = ''value''+
-</lt>+
- +
-*''WinName''! is optional. It specifies the window that the named object resides in. This is useful when there are several objects with the same name in a project.+
- +
-*''objName'' is the object's name, as entered in the Object Name text box in the Label Control dialog box.+
- +
-*''Property'' is one of the available ''objName'' properties.+
- +
-==Available General Properties==+
- +
-The generic properties of these objects are listed below. (Note that not all properties are available for all objects.)+
- +
- +
-{| border="1" style="x-cell-content-align: top; border-left-style: Double; border-left-width: 4px; border-right-style: Double; border-right-width: 4px; border-top-style: Double; border-top-width: 4px; border-bottom-style: Double; border-bottom-width: 4px; margin-left: 0.25in; margin-right: 0.25in; margin-top: 0.25in; margin-bottom: 0.25in; width: 600px; border-spacing: 0px" width="600"+
-|- class="hcp4" valign="top"+
-| style="width: 30%; padding-right: 10px; padding-left: 10px; border-left-color: #000000; border-top-style: Solid; border-top-color: #000000; border-right-color: #000000; border-right-style: Solid; border-bottom-style: Solid; border-bottom-color: #000000; border-bottom-width: 1px; border-right-width: 1px; border-left-width: 1px; border-left-style: Solid; border-top-width: 1px" width="30%" |+
-Property+
-| class="hcp5" style="width: 20%" width="20%" |+
-Access+
-| class="hcp5" style="width: 50%" width="50%" |+
-Description+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowBeginLength'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Length of beginning arrow heads in point size.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object''.arrowBeginShape'''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Shape of beginning arrow heads by position in drop down list, Object Control dialog box: 0 = none, 1 = filled, 2 = chevron, etc.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowBeginWidth'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Width of beginning arrow heads in point size.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowEndLength'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Length of end arrow heads in point size.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowEndShape'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Shape of end arrow heads by position in drop down list, Object Control dialog box: 0 = none, 1 = filled, 2 = chevron, etc.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowEndWidth'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Width of end arrow heads in point size.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.arrowPosition'''''<br><br>+
-Note that ''object''.arrowBeginShape<br>+
-and ''object''.arrowEndShape must also<br>+
-be set.+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Controls the display of arrow heads for each line segment of polyline and freehand objects:+
- +
-0 = no arrow heads.<br /> 1 = arrow at beginning of each segment.<br /> 2 = arrow at end of each segment.<br /> 3 = arrow at both ends of each segment.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.attach'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Attach to method:+
- +
-0 = layer <br /> 1 = page<br /> 2 = axes scales+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.auto'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Redraw automatically after property changes: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.background'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Control the background of an object as follows: 0 = no background, 1 = black line, 2 = shadow, 3 = dark marble, 4 = white out, and 5 = black out.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.color'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Line, text, or outline color index number. Use the '''[[LabTalk:color (function)|color()]]''' function, as in '''''name''.color=color(red);'''+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.dx''''', '''''object.dy'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Width and height in axes units.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.enable'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Enable hotspots on the object: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.event'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read only, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-The object's script execution: 1 = run script when button is clicked, 0 = all other events.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.fillColor'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Shape object fill color index number. Use the '''[[LabTalk:color_(function)|color]]''' function, as in '''''name''.fillcolor = color(red);'''+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.font'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Text label font index number. Use the '''[[LabTalk:font (function)|font()]]''' function, as in '''''name''.font = font(arial);'''+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.fSize'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Text label font size.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.height'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read only, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Height in layer coordinate units.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.hMove'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Horizontal movement: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.index'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read only, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Only applicable for objects composed of multiple items, such as the UIM objects. Indicates which item in an object has been affected by a Windows action.+
- +
-(Note: The UIM is a component of <span class="hcp1">OriginPro</span>. For more information, contact OriginLab or your Origin distributor.)+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.keepInside'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Restrict object's movement to within the layer frame: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.left'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Left location of the object in physical coordinates.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.lineType'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Line and arrow object line type: 1 = solid, 2 = dash, and 3 = dot.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.lineWidth'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Line or arrow object line width.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.mouse'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Mouse access to the object: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.name$'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Write only, string+
-| class="hcp9" style="width: 50%" width="50%" |+
-Object name.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.realTime'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Real-time update of substitution notation in a text label message: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.revVideo'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Reverse video display: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.rotate'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Text label rotation in degrees.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.script'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-<span class="hcp1">Script, Run After</span> mode index number, from the drop-down list in the <span class="hcp1">Label Control</span> dialog box.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.show'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" width="50%" |+
-Object display: 1 = visible, 0 = hidden. Hidden objects are not selectable+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-'''''object.states'''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read/Write, numeric+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Controls object edit states. The property is bit-oriented so that values can be added.+
- +
-Example: '''polygon.states = 3''', disables resizing and rotating for the object named polygon.+
- +
-0 = all controls are enabled.<br /> 1 = resizing is disabled.<br /> 2 = rotating is disabled.<br /> 4 = skewing is disabled.<br /> 8 = moving individual points is disabled.<br /> 16 = in place editing is disabled.<br /> 32 = resize text label border disabled.<br /> 64 = horizontal movement is disabled.<br /> 128 = vertical movement is disabled.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-'''''object.text$'''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read/write, string+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Message displayed by a text label.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-'''''object.top'''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Top of the object in physical coordinates.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-'''''object.vMove'''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Vertical movement: 0 = disable, 1 = enable.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-'''''object.width'''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read only, numeric+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Width in layer coordinate units.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" rowspan="1" colspan="1" width="30%" |+
-''''''''''object''.x, ''object''.y''''''''+
-| class="hcp9" style="width: 20%" rowspan="1" colspan="1" width="20%" |+
-Read/write, numeric+
-| class="hcp9" style="width: 50%" rowspan="1" colspan="1" width="50%" |+
-Axes X Y coordinates of the center of the object.+
-|- class="hcp4" valign="top"+
-| class="hcp6" style="width: 30%" width="30%" |+
-'''''object.x1, object.x2, object.y1, object.y2'''''+
-| class="hcp9" style="width: 20%" width="20%" |+
-Read/write+
-| class="hcp9" style="width: 50%" width="50%" |+
-'''x1''' and '''y1''' are the axes position of the first drawn point of the object (for example, the start location of a line).+
- +
-'''x2''' and '''y2''' are the axes position of the last drawn point of the object (for example, the end location of a line).+
- +
-For more control over drawing lines, see the '''draw - l''' command.+
-|}+
- +
-==Methods:==+
- +
-The syntax of the user-created object methods is as follows:+
- +
-[''winName''<nowiki>!]</nowiki>''objName''.''Method''(''arguments'')+
- +
-or+
- +
-this.''Method''(''argument'')+
- +
-''WinName''<nowiki>! is optional. It specifies the window that the named object resides in. This is useful when there are several elements with the same name in a project. </nowiki>+
- +
-''objName'' is the object's name, as typed in the Object Name text box in the Label Control dialog box.+
- +
-''Method'' is one of the available ''objName'' methods.+
- +
-''arguments'' are specific to the method.+
- +
-==Available General Methods:==+
- +
-''A''ppend the contents of ''stringVariable'' or ''my string'' to a text label. Requires a screen refresh to view the change.+
-<pre>+
- object.addText(stringVariable)+
- object.addText(my string)+
-</pre>+
-Examples:+
- +
-* Append text.+
-<pre>+
-%A=append this text;+
-text.addtext(A); // Note: use A not %A+
-text.addtext('append this text'); // Note: use quotation marks.+
-</pre>+
- +
-* Simulate a click on the ''n''th hot spot of the object. Multiple hot spots are a feature of UIM objects.+
-<pre>+
-object.click(n)+
-</pre>+
-* Redraw the ''object''. ''Option'' = local to redraw hot spots. ''Option'' = global to redraw the entire object.+
-<pre>+
-object.draw(option)+
-</pre>+
-* Run the script of the ''object''.+
-<pre>+
-object.run()+
-</pre>+
- +
-==Example==+
- +
-* The following script uses the '''addText''' method to add text to the text1 label. Note that the string variable argument does not include the percent character.+
-<pre>+
-%Z = " added to end of line";+
-text1.addtext(Z);+
-%Z="+
-added as a new line";+
-text1.addtext(Z);+
-text1.draw(global);+
-</pre>+
-* The next script disables horizontal movement for the Arrow object in the Graph2 window.+
-<pre>+
-Graph2!Arrow.hmove = 0;+
-</pre>+
-* When entered in the Script window, the next script types the X and Y coordinates of the center of the Button object to the Script window.+
-<pre>+
-Button.x =;+
-Button.y =;+
-</pre>+
-* The following script runs the script associated with an object named Mode in the Graph1 window.+
-<pre>+
-Graph1!mode.run();+
-</pre>+
-* The last script uses the '''draw()''' method to redraw the WksData object in the Data2 window.+
-<pre>+
-Data2!WksData.draw(global);+
-</pre>+
- +
-[[Category:Internal Object Overview_(Labtalk)|b]]+

Current revision

The contents of this page have been moved to:

Graphic Objects