|
| |
Objects can be placed onto the StampPlot background for
indication and control. The types of objects available include: Text
boxes, list box, drop-down box, image boxes, image-buttons, gauges and
more. Objects can be configured to be updated with values automatically
and code can be written when the object is 'activated' or an event takes place.
General procedures in using objects (Pro license required):
 | Use the Object Editor, Config Tab to reduce the plot
percent coverage (!PPER x%,y%). |
 | Use the Object Editor, Objects Tab to drag a control onto
an available place on the background. |
 | Set attributes of the object, such as top position, left
position, height, width, text, etc.
 | The background is a 100 x 100 grid from bottom-left to
top-right |
|
 | Set an Update Value for the object to change its attribute
when a !POBJ Update instruction is issued. |
 | Write Event Code for the object, such as when it is
clicked. |
 | Add a text tip to give the user a hint of the control's use. |
 | Once you have what you want, use the Macro Builder/Editor
to construct a macro of the configuration. |
Object Coding: (to test, copy and paste maroon-bold
text into the Immediate text window)
Graphically you can use the Object Editor to add and modify
objects. The Macro Builder/Editor
constructs a text file from your configuration. This is by-far the simplest method. Once constructed, the code may be
in a macro to configure StampPlot, or it may be sent serially form your
controller.
Of course, it's important to understand what is going on and
what the code means.
With Release 1.5, !POBJ may be abbreviated with !O.
!O Update
 | Creating
The general format for creating an object in code is (parameters in [ ]
are optional):
!POBJ objType.objName=L,T,[W,H,data,data...]
L=Left. T=Top, W=Width, H=Height
For example:
'Clear all objects
!POBJ Clear
'Reduce plot to 20% by 20%
!PPER 20,20
'Creates a button object named ButHi at 50,50 width of 15 (and default
height) captioned Hello
!POBJ oButton.butHi=50,50,15,,Hello
|
 | Setting
Once created the object may be set using
!POBJ objName.Set=data...
or
!POBJ objName=data...
'Sets lblHi to read Bye
!POBJ butHi=Bye
|
 | Automatic Updating
An update value may be set to update the object each time a !POBJ
Update instruction is issued (set up a timer to issue this at set intervals for
example). The data is the same as the Set data since Update simply
sets the object on update.
!POBJ objName.Update=data...
or
!POBJ objName.U=data
'Sets ButHi to be updated when !POBJ Update
is issued.
!POBJ butHi.U=(RTIME)
|
 | Event Code
Most of the objects have a means of triggering the event code. For
example, a button is clicked. When the objects event is activated, the
event code will be processed.
!POBJ objName.Code=code
OR
!POBJ objName.C=code
!POBJ butHi.C=!STAT (DATE) (RTIME)(ER)!BELL
Sets the event code to place the real time in the status box and ring a
bell. Click the button to test. (ER) is a event carriage return for allowing
multiple instructions. When using the Editor, Instructions may be
place on separate lines. When the macro is built, these carriage
returns will be replaced with (;) to indicate to StampPlot the code extends
to the next line.
|
 | Text Tips
Text Tips can be added to give tips to the user on the control when they
place their mouse over it.
!POBJ objName.Tip=tip message
!POBJ butHi.Tip=Click Me to see the time!
|
 | Font
Objects with text can have the font set. If ONLY the font size is
changed, this is reflected in the data for the object creation. If the
Font is changed, a Font instruction is generated by the Macro Builder.
!POBJ butHi.Font=font_name,size,bold (0/1), Italic (0/1)
OR
!POBJ butHi.F=font_name,size,bold (0/1), Italic (0/1)
!POBJ butHi.Font=Times New Roman,12,1,1
|
 | Moving
All objects can be moved in code. This can be used for special effects
of moving objects using code.
!POBJ objName.Move=[L,T,W,H]
OR
!POBJ objName.M=[L,T,W,H]
!POBJ butHi.M=80,,,10
Moves object to Left of 80, Height of 10.
|
 | Visibility
Objects can be set visible or not visible.
!POBJ objName.Visible = 0 or 1
OR
!POBJ objName.V=0 or 1
|
 | Setting Focus
Code can be used to set the current cursor focus to an object
!POBJ objName.SF
|
 | Running Event Code in other ways
 | Event code can be ran for a particular object by using:
!POBJ objName.Run |
 | Objects with names beginning with DA_ (such as
DA_butHi) will have their event code automatically processed whenever
analog data arrives. |
 | Objects with names beginning with DB_ (such as
DB_butHi) will have their event code automatically processed whenever
binary data arrives.
|
 | Objects with names beginning with DM_ (such as DM_txtMsg) will have their event code automatically processed whenever
message data arrives.
|
|
 | Object Values
 | Objects can return values to be used in processing or
read by the controller. As with all StampPlot Values, they need to be enclosed
in parenthesis. For example
!STAT (butHi)
Places the text value of the button in the user status box.
|
 | All control objects can return their positions and
other values
!STAT (butHi.T) (butHi.L) (butHi.W) (butHi.H)
|
 | ME is a special value to be used only in Event
Code (or when using !DEFS, but that's another use).
(ME) returns the name of the current object
((ME)) returns the value of the current object.
Test this out:
!POBJ butHi.C=!POBJ (ME).Move=[((ME).L),-,5],[((ME).T),-,5]
Now click the button.
[ ] indicate a math operation.
|
 | To read a value of an object on the Plot, have the
controller send a !READ (objName).
The value will be returned as an ASCII string (if micro echoes data is
enabled, a |Q| will be appended for filtering by StampPlot. StampPlot
of course can send data with out a request, in the code use !SEND
(objName). See the Interactive discussions or refer to examples.
|
|
 | Deleting an Object
A control object may be deleted through code using:
!POBJ objName.DEL
To Delete all Objects, use !POBJ Clear
|
 | Object WildCard
Mutliple objects may be updated at once using wildcard.
!POBJ txt*.V=0
Makes all objects named starting with txt
invisible.
!Pobj but*.Tip = Click me!
Sets all objects named starting with but to have a text tip of 'Click Me!' |
Please see specific control objects for their unique
instructions, values, and use.
|