Using the Editors |
To some degree, when you define the way things look, you also define the way those things act. This chapter describes how you control what the user sees, for example:
Giving Widgets Initial Data |
You can specify that a widget has initial data or displays some initial text. This data is what displays when the screen first opens; it's what the user sees. Therefore, initial text can be, for example, instructions for the user, a default or suggested selection, or an identifier. The property to enter this information varies by widget type.
Changing Widget Type |
Through the editor you can change a widget from one type to another. For example, you can change a single line text widget into a list box, change a vertical scale to a horizontal scale, or a combo box into an option menu.
Note: Lines, boxes, graphs, grid widgets, and links cannot be changed to other widget types.
The original widget is replaced with a default widget of the specified type. Any properties that you defined for the original widget that are common to the new widget type are applied; however, properties which are not valid for the new widget are lost. Panther attempts to position the new widget in the same place as the original.
Initial text can be lost, particularly in cases where you change a multiarrayed widget, such as a list box, to a widget with a single onscreen element, like a single line text widget or option menu.
Formatting Text |
Formatting text in a widget includes:
Widgets designated as hidden are visible in Edit mode in screen editor, but are not visible in Test mode or at runtime.
To Display or Not Display
How to Hide a Widget at Runtime
For example, on a logon screen, you might initially hide a password field to those users who, in fact, do not require passwords. However, if the user's name indicates that a password is required, you can change the Hidden property (refer to "Properties" in Application Development Guide for information on changing properties at runtime).
Widgets designated as always hidden are useful for storing data that are used in screen processing.
Note:
A hidden widget, whether the property is set to Yes or Always, is protected from user input and is not included in the tabbing order while it is invisible. If a grid widget is designated as hidden, all members of the grid are hidden as well.
All initial text (as specified in the Initial Text property) is made invisible. At runtime, the field can be seen, however, characters typed or accepted into the field are not displayed. This property is useful for creating password fields.
For example, if you enter *
, each character the user types in the field is represented by an asterisk. All initial text (as specified in the Initial Text property) is replaced with the specified password character.
In the English language, characters are usually entered from left to right; they are left-justified. By default, the characters in all widgets are left-justified, except for toggle buttons and push buttons, which have a centered label.
You can change the text justification on the following widget types: single line and multiline (without a word wrap specification) text widgets, dynamic labels, option menus, combo boxes, radio buttons, check boxes and list boxes.
In Motif, you can change the default alignment of label text by making the appropriate entries in the resource file for your application. By default, all push button and toggle button labels are centered:
Prolifics*area*XmPushButton.alignment: ALIGNMENT_CENTER
Prolifics*area*XmToggleButton.alignment: ALIGNMENT_CENTER
To left justify all push button and toggle button labels, set these resources to ALIGNMENT_BEGINNING
:
Prolifics*area*XmPushButton.alignment: ALIGNMENT_BEGINNING
Prolifics*area*XmToggleButton.alignment: ALIGNMENT_BEGINNING
To right justify all push button and toggle button labels, set the resource values to ALIGNMENT_END
:
Prolifics*area*XmPushButton.alignment: ALIGNMENT_END
Prolifics*area*XmToggleButton.alignment: ALIGNMENT_END
To left justify all push button labels on a specific screen, use the following resource specification in your resource file:
Prolifics*screen_name
*area*XmPushButton.alignment: ALIGNMENT_BEGINNING
Prolifics*screen_name
*area*XmToggleButton.alignment: ALIGNMENT_BEGINNING
For example, to left justify all push button labels on the screen named myscr
, set the following resource:
Prolifics*myscr*area*XmPushButton.alignment: ALIGNMENT_BEGINNING
To align the label on an individual button on a screen, use the following resource specification in your resource file:
Prolifics*screen_name
*area*button_name
.alignment:alignment_specification
For example, to right justify the label on the widget mybutton1
only when it appears on the screen myscr
, set the following resource:
Prolifics*myscr*area*mybutton1.alignment: ALIGNMENT_END
To align the label on a button throughout your application, use the following resource specification in your resource file:
Prolifics*area*button_name
.alignment:alignment_specification
For example, the following resource specification will center the label on mybutton2
wherever it appears throughout the application.
Prolifics*area*mybutton2.alignment: ALIGNMENT_CENTER
You can use fonts in your application that are:
When you create a screen, a default font is applied, derived either from a Panther distributed configuration map ( The Default setting means that at runtime Panther resolves which fonts to apply based on what is set at a higher level. Therefore, a widget's Default specification means it uses the screen font assignment. The screen's Default specification means it uses the application-wide specification.
You can define fonts at any of the following levels:
cmap
) file or from your GUI platform. Under the Font heading in the Properties window, all font-specific properties are set to Default for the screen and for any widgets you add to the screen (except for those that have a font assignment of their own, because the widget is a copy or inherits its property values from a repository entry).
default_font
assignment of your cmap
file (provided with your installation and specific to your terminal type). In the absence of an application default specification in the cmap
file, the system default is used. For information on assigning an application-wide font, refer to "Default Font" in Application Development Guide.
grid widget members can each have a unique font specification. The font defined for the grid widget itself determines the font used for the column titles and row titles.
Note:
Under Motif, the individual members of a grid as well as the column titles and row titles acquire the font defined for the grid widget as a whole.
Graph widgets have their own set of font name specifications (prefixed with the word Graph) in addition to Prolifics fonts and system fonts. A single font specification applies to the entire graph. The point size for graph components, such as graph titles, subtitles, legends, and labels, is defined under the Graph heading in the Properties window. Refer to "Controlling Graph Text" for details on defining graph fonts.
Prolifics fonts include several standard font styles: Courier, Helvetica, Symbol, and Times Roman, etc. These are defined in your Panther configuration map file, and resolve appropriately to a GUI-specific font for your platform. Depending on the platform and the font selection, a point size and other display attributes are automatically assigned. (For details on editing the Assigning a Prolifics Font
cmap
file, refer to "Configuration Map File" in Application Development Guide.)
How to Assign a Font to a Screen or to One or More Widgets
cmap
file, plus Default.
Under Windows, you can also enter a value if the font is scalable.
Note: If you specified a font that includes default attributes, such as bold, italic, or underline, the following steps may have no effect on the way the font looks.
GUI-specific fonts are the least portable. Your specifications will reside with the screen and you should map them as needed in the configuration map file. Selecting a font in this way, as described here, allows you to choose attributes that may not be included in your cmap
file and see a sample of how the selected font looks.
Under Windows, Panther sets the point size and other style options to Yes in the corresponding properties—Bold, Italic, and Underlined. If the styles do not apply, the properties remain set to Default.
To distinguish between when a field is null and when it has data that is not visible or available (for example, a field that is blank), you can specify that it should display a null indicator string when no data is present. A field is considered null if both of the following conditions are met:
When a field is null, the null indicator string is displayed in the field, and the field is, by default, selected on entry. The null indicator string is cleared when the user enters data.
The null indicator is defined as blank in the To distinguish a blank field from an empty (null) one, you can either:
SM_NULLEDIT
variable in your Panther message file. If you prefer a different default null indicator, you can change the value of SM_NULLEDIT
. (For information on editing the message file, refer to "Creating and Modifying Message Files" in Application Development Guide.)
SM_NULLEDIT
variable to something other than blank, or
How to Allow a Widget to Accept and Display a Null Value
For example, enter an X
, an *
(asterisk), or null
.
Whatever character or string you have entered in the Null Text property will fill the field to its maximum length. The Repeating property has no effect if you do not specify a Null Text property.
Widgets that have a Null Field setting are made null at runtime if any of the following occurs:
Use the library function sm_null to determine whether or not a field is null. The function sm_getfield returns the content of the field, which is the null text string (possibly replicated) if the field is, in fact, null.
To control the appearance of data in grid widgets, you can set the following properties:
Controlling Grid Formats
Creating Shifting/Scrolling Fields |
A widget must occupy at least one position on the screen. However, a widget can be larger, in two dimensions, than its onscreen capacity; a field can shift and scroll. Shifting extends a field's widget beyond its onscreen width. Scrolling permits a field to hold more data items that will fit onscreen.
Each widget is an array, although for the most part, an array of one occurrence. This is the base field. You increase the array to include additional occurrences by specifying that the widget has more than one element; the base field is the first element of the array.
Each element of an array is assigned a unique field number, but shares its properties with the base field. You assign a name to the array as a whole, and not for each element. The array slots are called occurrences. The elements of the array are the mechanism through which the array's occurrences are viewed. A scrolling array can have more occurrences than elements. A simple array has the same number of occurrences as elements.
Any widget that has either the Onscreen Rows property or Array Size property can be defined as a scrolling array. When you specify that a widget has a greater number of occurrences than can be displayed on the screen, the widget is referred to as a scrolling array.
For details on creating synchronized arrays, refer to "Synchronizing Scrolling Arrays."
The Max Occurrences value must be greater than or equal to the number specified in the Array Size property or Onscreen Rows property in order to scroll.
If the maximum length of a widget is greater than the display length, the widget is referred to as a shifting field. By default, single line and multiline text widgets are shifting fields.
Note: This number does not necessarily define the number of characters that are displayed, especially if your screen or widget uses a proportionally spaced (varied-width) font.
Creating a Date and Time Field |
You can assign a date and/or time format to almost any widget type (except static labels and scales). You can enforce a format for user-entered dates or times, or specify the format in which the system date or time is displayed.
Note: By default, the property is set to None. However, if the widget is derived from a database column and has as a date/time edit, Panther sets the Data Formatting property to Date/Time.
date_format
at runtime), select one of the following:
If the interval is set to zero, the system date/time is updated only under the following conditions:
Note: If you specify a 12-hour clock, consider a custom format that includes an AM/PM indicator.
In addition to the default settings that you can specify by name, you can format a date or time string to suit your needs by using combinations of literal strings and Panther-specific substitution variables (refer to Table 10-2).
A literal character forces entry of that particular character. A substitution variable forces entry of a string that matches the specified format. For example, if you enter a Custom Format setting of HR:MIN:SEC
, a runtime entry of 09:19:21
is accepted.
To embed punctuation, such as spaces, slashes, or colons, enter literal characters as part of the Custom Format setting. Table 10-1 illustrates samples of date/time format strings and input that is considered valid.
Format String | Acceptable Input |
---|---|
|
|
|
|
|
|
|
|
Table 10-2 lists the substitution variables you can use for customizing date/time formats.
Defining a Numeric Format |
You can display data as a string of numbers with the appropriate punctuation, like a comma and decimal point, or assign the appropriate currency characters to display monetary data. The format you define is applied to the data during field validation, and non-numeric data is discarded.
numeric_type
at runtime), select either of the following settings:
For more information, refer to "Creating a Default Numeric Format" in Application Development Guide.
If Min Decimals is greater than the Max Decimals specification, numbers entered in the fields are rounded to the nearest whole number, and the number of decimal places specified is padded out with zeroes. For example, if Max Decimals is 0 and Min Decimals is 2, entering the number 22.546 displays as 23.00.
Refer to Table 10-4 for examples of how rounding options work.
Number Entered | Round Up | Round Down | Round Adjust |
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
Yes—(default) Applies the format to data that is equal to zero, and the field remains empty (blank) if no data is entered.
No—The field remains empty if the data equals zero or no data is entered.
Yes—Applies the format to the field even when it is empty. For example, at runtime, when the field or screen is validated, if data was not entered in the field, the defined format is displayed— No—(default) The field remains empty (blank) if no data is entered.
Note:
The Empty Format subproperty has no effect unless the Zero Format property is set to Yes.
$0.00
for instance.
Giving Screens a 3D Appearance |
Panther allows you to provide a three-dimensional appearance to your screens and the widgets on those screens when you are running Panther or a Panther application under Windows.
Note: If you are running Panther under Motif, which provides native support for three-dimensional widgets, use the settings in your Motif environment to enable or disable the 3D feature.
Select the screen. Under Identity, set the 3D property to one of the following:
.ini
file). Refer to 3D in Configuration Guide for a description of the 3D option in your Windows .ini
file.
If the 3D option is enabled in the The 3D screen property setting is ignored when Panther is running on a platform other than Windows. Thus, if your application will run on multiple platforms, Windows among them, set the 3D property to the value that will give the desired appearance under Windows; when the application runs on any other platform, screen appearance is unaffected.
This section describes how screens, and the widgets on those screens, appear when the 3D feature is enabled under Windows.
The background color of 3D screens and dialog boxes is determined by the Button Face color setting on the Windows control panel, and overrides the background color specified in the Properties window for the screen.
Dialog box title bars appear indented; title bars on non-dialog screens do not have a 3D appearance.
Screen size might increase slightly if additional space is needed to accommodate the 3D effects imposed on the screen's widgets.
The following widgets do not change appearance when 3D is enabled:
.ini
file for your application, message boxes and Windows common dialog boxes also take on a three-dimensional appearance. If this initialization option is not set, only those application screens that have the 3D screen property set to Yes appear in 3D.
Three-Dimensional Screen and Widget Appearance
Screens
Widgets
All other visible widget types change in appearance, as described below. Unless otherwise noted, all widgets affected by the 3D setting take on the same back ground color as the screen on which they appear (that is, the Button Face color setting on the Windows control panel).
The amount of screen real estate needed by 3D widgets might increase slightly because of the border used to create the three-dimensional effect.
Text and multiline text widgets appear indented into the screen, with a 3D border around the entire widget.
List boxes appear indented into the screen, with a 3D border around the entire widget. Scroll bars are the screen background color if active; if inactive, they are the Window Background color, as set on the Windows control panel.
Option menus appear indented into the screen, with a 3D border surrounding both the text and the drop-down area.
The text area of the combo box appears indented into the screen. A 3D border surrounds the text area only and not the drop-down button.
The selection area on check boxes (square) and radio buttons (circle) appears indented into the screen; its color is the Window Background color, as set on the Windows control panel. The selection indicator (X or dot) is black. The label text does not appear 3-dimensional.
If the Line/Box Style property is set to Default, the line or box appears in the Etched In style. If it is set to any other style, the line or box is unaffected by the screen's 3D setting.
Boxes with a Line/Box Style property set to Default or Etched In take on the background color of the screen; if the Line/Box Style is set to any other value, the background color setting in the Properties window remains in effect.