Smart Message object

On the Graphics tab, in the Active Objects group, click Smart Message to create one or more smart message objects, which you can use to display messages and graphics based on tag values when you run your project. IWS provides the following smart message object types:

These smart message object types vary in their ability to display messages and graphics, write to a tag, and control how many messages and graphics display on the screen. However, all of the object types can receive process input (Read Tag value) to determine which message to display.

To add a smart message object to the screen:
  1. Click the Smart Message button and position the mouse on the screen.
  2. Click and drag to create (and adjust the size of) a rectangle.

    You use the rectangle's size and font size to determine how much text and how large a bitmap image you can display on the screen. Later, you can change the rectangle's size and font characteristics to allow longer messages to display in a given space.

  3. Double-click on the object to open the Object Properties dialog.
Figure 1. Object Properties: Smart Message

You can use this dialog to specify the following parameters:
The following table describes the meaning of the properties associated with each message, regardless of the Data Source:
Property Description
Text/Message Message (text) that will be displayed when selected during runtime. You can include tags in a message by enclosing them in curly brackets (e.g., {tagname}).
Value You must associate a unique value with each message. during runtime, the object will display the message associated with the value that matches the value of the tag configured in the Read Tag field. If there is no such message, the message configured in the first row (State = Error) displays during runtime. When the object Type is set as Multistate Pushbutton, the value associated with the current message is also written to the tag configured in the Write Tag field (if any).
Text (FG) Foreground color for the messages displayed during runtime.
Text (BG) Background color for the messages displayed during runtime.
Text Blink If checked, the message text will blink during runtime.
Rec (FG) Line color (Border) for the rectangle behind the message.
Rec (BG) Background (Fill) color for the rectangle behind the message.
Rec Blink If checked, the rectangle behind the message will blink during runtime.
Graphic File Path and name of the bitmap file (*.BMP) (if any) that will be displayed when the message associated with it is selected during runtime. If you do not specify the path, the bitmap file must be stored in your project folder.
Transparent Select the color that will be transparent in the graphic file, if the En. Transparent checkbox is checked.
En. Transparent If checked, the color selected in the Transparent field will be set as transparent in the graphic file.
Note: The properties Graphic File, Transparent and En. Transparent are not available for the Message Display type.
Tip: You can copy data from this dialog and paste it into an Excel worksheet, and vice versa.

Source File Format

This section describes the format of the text file supported by the Smart Message object when the Data Source = Text File. The main advantage of using an external text file instead of static values is that it gives you the flexibility to change the messages during runtime, by pointing to a different text file, or even by changing the content of the text file dynamically.

The text file must be created in the CSV format (comma separated values), where the comma character ( , ) is used to divide the columns (data) in each line (row) of the file. Therefore, you can use any CSV editor such as Microsoft Notepad and Microsoft Excel to create the CSV file with the messages and their properties for the Smart Message object.

The description of each property associated with the messages is provided in the Smart Message section. The order of the data in the CSV file is described in the following table:
Column # Property Default Value
1 Text/Message -
2 Value -
3 Text (FG) 0
4 Text (BG) 16777215
5 Text Blink 0
6 Rec (FG) 8421376
7 Rec (BG) 16777215
8 Rec Blink 0
9 Graphic File -
10 Transparent 0
11 En. Transparent 0
When configuring text messages that have the comma character as part of the message, you must configure the whole message between quotes (e.g., "Warning, Turn the motor Off" ); otherwise, the comma will be interpreted as a data separator instead of as part of the message.
  • The first line of this file is equivalent to the State = Error. In other words, if there is no message associated with the current value of the tag configured in the Read Tag field, the message configured in the first row (State = Error) is displayed during runtime.
  • The data configured in the Value column of the first row from this file is irrelevant. This row must always be configured, regardless of the object type (even for Multistate Pushbutton).
  • Only the Text/Message and Value columns are mandatory. The other columns are optional, and the default values will be used if you do not specify any value for them (see table).
  • The fields Text(FG), Text(BG), Rec(FG), Rec(BG) and Transparent can be configured with the code of the color associated with it. The code can be entered directly in decimal format (e.g., 255) or in hexadecimal format using the syntax #value (e.g., #0000FF).
  • The fields Text Blink, Rec Blink and En. Transparent can be configured with Boolean values 0 or 1 (0 = Unchecked; 1 = Checked), or with the keywords FALSE or TRUE (FALSE = Unchecked; TRUE = Checked).
Example:
Error Message,,0,16777215,1,8421376,16777215,1,error.bmp,0,0
Message Zero,0,0,16777215,0,8421376,16777215,0,open.bmp,65280,1
Message Ten,10,0,16777215,0,8421376,16777215,0,closed.bmp,65280,1
Message Twenty,20,0,16777215,0,8421376,16777215,0,,0,0
Message Thirty,30,0,16777215,0,8421376,16777215,0,,0,0
Tip: You can use the Smart Message editor (Data Source = Static) to configure the messages, values and colors. To do so, select the configuration, copy it and paste it into an Excel worksheet. Then, you can save the Excel worksheet as a CSV file (File > Save As). This procedure provides you with a user friendly interface for configuring the color codes.