Saturday, September 25, 2010

Strings

Summary: In this lesson, you will learn how to create string controls and indicators.
A string is a sequence of displayable or non-displayable ASCII characters. Strings provide a platform-independent format for information and data. Some of the more common applications of strings include the following:
  • Creating simple text messages.
  • Passing numeric data as character strings to instruments and then converting the strings to numeric values.
  • Storing numeric data to disk. To store numeric values in an ASCII file, you must first convert numeric values to strings before writing the numeric values to a disk file.
  • Instructing or prompting the user with dialog boxes.
On the front panel, strings appear as tables, text entry boxes, and labels.

Creating String Controls and Indicators

Use the string control and indicator located on the Controls>>Text Controls and Controls>>Text Indicators palettes to simulate text entry boxes and labels. Use the Operating tool or Labeling tool to type or edit text in a string control. Use the Positioning tool to resize a front panel string object. To minimize the space that a string object occupies, right-click the object and select the Visible Items>>Scrollbar option from the shortcut menu.
Right-click a string control or indicator on the front panel to select from the display types shown in the following table. The table also shows an example message for each display type.
TABLE 1
Display TypeDescriptionMessage
Normal DisplayDisplays printable characters using the font of the control. Non-printable characters generally appear as boxes. There are four display types.There are four display types. \ is a backslash.
'\' Codes DisplayDisplays backslash codes for all non-displayable characters.There\sare\sfour\sdisplay\stypes.\n\\\sis\sa\sbackslash.
Password DisplayDisplays an asterisk (*) for each character including spaces.***************************** *****************
Hex DisplayDisplays the ASCII value of each character in hex instead of the character itself.5468 6572 6520 6172 6520 666F 7572 2064 6973 706C 6179 2074 7970 6573 2E0A 5C20 6973 2061 2062 6163 6B73 6C61 7368 2E

Tables

Use the table control located on the Controls>>All Controls>>List & Table palette or the Express Table VI located on the Controls>>Text Indicators palette to create a table on the front panel. Each cell in a table is a string, and each cell resides in a column and a row. Therefore, a table is a display for a 2D array of strings. The illustration in Figure 1shows a table and all its parts.
Figure 1: 1. Cell Indicated by Index Values, 2. Column Headings, 3. Vertical Scrollbar, 4. Horizontal Scrollbar, 5. Row Headings, 6. Horizontal Index, 7. Vertical Index
Figure 1 (tableparts.png)
Define cells in the table by using the Operating tool or the Labeling tool to select a cell and typing text in the selected cell.
The table displays a 2D array of strings, so you must convert 2D numeric arrays to 2D string arrays before you can display them in a table indicator. The row and column headers are not automatically displayed as in a spreadsheet. You must create 1D string arrays for the row and column headers.

Content actions

GIVE FEEDBACK:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers