iW+ provides the ability to add front panel controls and numeric's to any page, as shown in the following picture. For a concise summary of User Defined Popups, Edit Fields, Dynamic Text, Buttons, and Pages; click here; and for details, please continue reading.
iW+ provides regions within the main window, called "pages", which are selected with a tab at the base of the instruNet World window, illustrated above. Record, Network, Test, and Script are standard pages included with instruNet. Additionally, the end user can create new pages that contain a text editor in the center of the window surrounded by buttons (which execute scripts when pressed), popup menus, text fields, and panel meters.
The standard Record, Network, Test, and Script pages (illustrated below) are heavily documented here. In summary, the Record page displays waveforms that are selected for recording in the Network page, the Network page shows and allows for the adjustment of channel settings, the Test page displays a list of installed hardware, and the Script page is used to develop iW+ scripts. One can hide any or all of these pages to simplify an instrument, as described here.
User Defined Text Editor Pages
Text Edit regions, as illustrated below, enable one to view and edit text in a manner similar to that done with a word processor. With commands in the menubar, one can Clear (File > New), Save (File > Save As), View (View menu), and Print (File > Print) the Text Editor contents. Also, one can type and edit text with the standard Cut, Copy, and Paste commands available in the Edit menu and from the Control X, V, and C keys. The Test page contains a Text Edit region, yet one can create more with the Create Panel Item > Page command in the Setup menu. For example, in a simple case, one might create a page called "Help", that when selected, displays documentation on how to use your instrument. The example below shows 2 user defined pages, labeled "Page 1" and "Page 2", where Page 1 is currently selected and contains a text editor region that shows the text "One can type ·".
To create a new page that contains a text editor in addition to optional popups, edit fields, panel meters, dynamic text fields, and buttons; select Create Panel Item > Page in the Setup menu. Subsequently, a Page Options dialog appears, as described below. To edit an existing page, select Edit Panel Item > Page in the Setup menu; and to delete a user defined page, select Delete Panel Item > Page in the Setup menu.
The Page Options dialog, illustrated below, is opened for an existing user defined page by selecting Edit Panel Item > Page in the Setup menu.
Page Name has dual uses -- it appears in the tab bar at the bottom of the window (and therefore used to select and show the page), and it is used to reference a page in script code (with spaces replaced by underscore characters "_"). For example, the Print script command prints to the currently selected page unless a page is specified as the first parameter. For example, if one creates a new page called "Data", then Print Data "abc" will print "abc" to the Data page. The following script commands all reference pages by their name: Print, Append, Copy, Execute, Digitize, Table, Show/Hide Page, Select, Clear, Erase, NewPage, NewButton, and Press.
Show enables one to show or hide a page and its corresponding tab. One can adjust this field programmatically via the A HREF="scriptreference.html#show_hide_page">Show/Hide Page script command.
Tab Space determines the number of characters between each tab. For example, if tab space is set to 16, then tabs are created every 16 characters at positions #17, #33, #49, etc. When printing text to pages from the script language, "\t" refers to a tab character and "\r" refers to a carriage return. These two special characters enable one to build tables.
Word Wrap determines if text automatically wraps to the next line when it hits the text edit region right edge, or extends out of view.
If Save Text is ON, the current text is embedded inside the .prf instrument file when one saves the setup (i.e. press Network Save button, or select Save Setup As under Setup); and restored when one loads that setup. For example, one might want to save instructions on how to use the instrument in a page called "Help", yet not save the text in a page called "Data" that is used to collect digitized data in a table.
Popup Menus, Edit Fields, Dynamic Text fields, and Panel Meters are collectively known as "Panel Items". For a brief summary of each, click here. Panel Items are created by the end user and can appear on any page, and in any one of the 4 quadrants within a page (i.e. Left, Right, Top, and Bottom). Shown below is an example of one Popup in the Left quadrant and one Edit Field in the Right quadrant of the Test page.
Shown below is a second example with one dynamic text field in the Top quadrant and one Panel Meter in the Bottom quadrant of the Record page.
Panel Item Position Options
The Options dialog for each panel item (e.g. Popup, Edit Field, Dynamic Text, and Panel Meter) contains several positions fields which control the placement of the item, as illustrated above, and described below.
Position determines the quadrant, which is one of Left, Right, Top, Bottom; or Hide panel item.
Page determines the page in which the panel item appears (e.g. Record, Network, Test, User Defined Pages, etc).
Order is an integer between 1and 1e9 that determines the order in which panel item appears within the specified page and quadrant. Items appear in numerical order, indexed by this field, where 1 appears first. For example, if Pop1 order is 1000, Pop2 is 20, and EditField3 is 100; and these three items are in the same quadrant on the same page; they would appear in the order Pop2 (since its Order field is the lowest), EditField3, and Pop1.
Creating, Editing and Deleting Panel Items
To create, edit, or delete user defined Popups, Edit Fields, Dynamic Text fields, Buttons and Pages; one must select Create Panel Item, Edit Panel Item, or Delete Panel Item in the Setup menu.
Dynamic Text & Edit Fields
Dynamic Text and Edit fields, as illustrated to the right, display a short segment of text at a specific quadrant within a specific page. The difference between these two is that Edit fields can be edited by the end user on the iW+ window (like a text editor), and Dynamic text cannot. In the above example, Field 1 is Dynamic Text (not editable), and Field 2 is an Edit field. We will refer to these two types of fields collectively as "Text fields". Note that editable fields will appear within a box.
Accessing Text fields from within Scripts
Text fields can be easily updated with a line of script code. For example, if a text
field was named "Field1", then Field1$ = "abc" in a script would cause the field to display "abc". From a script's point of view, a Text field is like a string variable that can be read or written via its user name suffixed with a "$" character, and with space characters converted to underscore characters (e.g. field name "temp 1" is referenced in script code as "temp_1$").
Creating Text fields
To create a Text field, select Create Panel Item > Text Field in the Setup menu (to open the Text field options dialog, shown below); set the Editable field to Off if creating a Dynamic Text field and On if creating an Edit field; set the Position field to one of Left, Right, Top, or Bottom; and then set the Page field (page in which field is displayed, e.g. Record) as desired. For details on panel item positions, click here.
After adjusting the position options, select General in the Settings popup to view the Text, Name and Label fields, illustrated below.
Here, one can view and/or edit the field's displayed text (i.e. the Text field), adjust the Label that precedes the displayed text in the iW+ window, and adjust the Field Name that references the field within the script code. For an example of an instrument that uses text fields, click here.
Panel Meters, as illustrated to the right, show a channel's engineering units value, or a function of that value (e.g. "abs(value) * 10"). Each input and output channel (analog or digital) has its own Panel Meter that is hidden until turned on by the end user (i.e. Panel Meter Position field is set to one of Top/Bottom/Left/Right instead of Hide). When one sets up a panel meter, they must specify the page in which it appears, the Top/Bottom/Left/Right position within that page, and whether or not the units label is shown (e.g. "Volts", "C", "µStrain"). In the above example, three Panel Meters are shown with their unitsâ labels, each of which have been set to "Volts" in the channel General setting area.
Panel meters update at the rate set in the Script Options User Rate field (accessed by selecting Script Options in Script menu) in units of updates-per-second; and update whether or not you are digitizing. A typical rate is 2 (i.e. twice a second). Recall that User Events are similar to Control Events, except they update at all times whereas Control Events only run while digitizing (e.g. after pressing Start button in Record page).
Panel Meter Calculation
The Calculate field within the Panel Meter options dialog enables one to display a function of a channel's value. For example, if one wanted to display the absolute value of a channel's value times 10, they would place "abs(Value) * 10" into the channel's Panel Meter Calculate field. The "Value" keyword in a channel's Panel Meter or Control Calculate field refers to the current engineering units value (e.g. Volts, degrees C, µStrain) of that channel, which is the same value as that displayed in the Network page Value Input column. If one leaves the Panel Meter Calculate field empty, the channel's value is displayed in the panel meter. For a list of math functions supported in the Calculate fields, click here. For information on output channel panel meters (e.g. D/A), click here. For examples of Panel Meters, click here.
Panel Meter Options
To view or edit panel meter options, as illustrated below, select a channel in the Channel Options submenu within the Hardware menu, and then select Panel Meter in the Settings submenu within the Channel Options dialog. As noted above, to turn on a Panel Meter, one sets the Position field to something other than "Hide".
A front panel popup menu allows one to select one of several choices in a list, as shown to the right. One line of script code reads or sets the position of the popup, where 1 refers to the upper-most item, 2 the one below it, etc. For details on accessing a Popup from script code, click here. Popups are created, edited, and deleted in the same manner as that done with Text fields, described above. The only difference is the Popup Options dialog, shown below, has an Item List field that contains a list of items in the popup, separated by commas. For example, if one wanted a Popup that showed two options, "On" and "Off", Item List would be set to "On, Off"; and a setting of On would be read as 1 and a setting of Off would be read as 2 in script code.
Detecting a change within a Popup or Edit Field
In some cases, one might want to execute script code when a Popup or Edit field is adjusted by the user within the iW+ window. To do this, one would check for a change with the code, similar to that shown below, which detects a change to popup menu "Pop1":
If (Pop1_last! != Pop1!)
Pop1_last! = Pop1!
... process change ...
If one wanted to execute this check periodically, whether digitizing or not, it would be placed into the User script; otherwise, to make this check only while digitizing, it would be placed into the Control script. To initialize the Pop1_last! variable, one might set it to -1 in the Before Script Engine script.
User Defined Buttons
One can easily create buttons that execute scripts when pressed. These buttons appear at the top of the window, in a specified page, in a quantity only limited by available window space. One might have room for 10 to 20 buttons per page, depending on the size of the monitor. In the above example, all buttons in the Record page have been hidden, except Start and Stop; and a new button called "Button 1" has been added. For information on how to hide any button, click here. For information on how to set up any button to execute a script, click here.
Creating, Editing & Deleting Buttons
To create a button, select Create Panel Item > Button in the Setup menu and adjust the options as needed. To edit the options of an existing button, select Edit Panel Item > Button in the Setup menu; and to delete an existing button, select Delete Panel Item > Button in the Setup menu.
The Button Options dialog, illustrated below, is described as follows:
Button Name determines the button's text, as it appears inside the button rectangle. In the above illustration, for example, the right-most button is named "Button 1".
Page determines which page the button appears on (e.g. Network, Record).
View determines whether or not the button is shown or hidden.
Link to Key optionally specifies a function key (F1 · F10), which when pressed, executes the button's script.
Pressing Jump To Script opens the script editor for the button's corresponding script.
Accessing a Button's Script
One can access a button's script in one of two ways. One method is to select Edit Panel Item > Button in the Script menu and then press the Jump To Script button in the Button Options dialog; and the other method is to select the Script page (i.e. press Script tab at bottom of window) and then set the script selection popups at the top of the window to "After Press Button PageName ButtonName". Related Topics: Script Page Reference.