![]() Chapter Contents |
![]() Previous |
![]() Next |
| SAS/AF Software: Class Dictionary |
| Moving Widgets in a Data Form |
Widgets can be moved within a page or across pages in a data form. To move a widget within a page, use the pop-up menu or drag and drop operations.
To move a widget across pages in a data form, follow these steps:
Cut to form buffer from the pop-up
menu for the widget.
Paste from form buffer to paste the
widget on the new page.
| Data Form Layouts |
In a Data Form, a layout consists of widgets which allow a user to interact with the data from the specified table. As the developer, you can control how the user enters and views the data by displaying the data using any widget available in a FRAME entry. Layouts can be as simple as a default layout or more complex.
The Data Form allows the flexibility to create any type of layout that
your particular application needs using all of the normal FRAME operations,
such as, make, move, and resize.
You can create a new layout in one of several ways:
If you have customized your display but want to return to the default layout, you can start all over again by selecting the
| Refill Using Attributes |
No matter how you create a new layout, you can add, delete, or modify any of the widgets in the layout at any time to customize the layout to your particular application. When using a Data Form, you can start from a blank layout by hiding all of the columns in the Customize Columns attribute window and then create and arrange the widgets inside the layout as needed. To save your customizations, you must specify a DATAFORM entry.
When creating a new layout, a default set of attributes is used to create the layout. These attributes are controlled using either the Customize Form window or by calling methods on the Data Form. The following is a list of methods that control the appearance of a new (default) layout and are called automatically for you:
| _setAttributes | _setDataBackgroundColor | _setDataClass | _setDataColor | _setDataFont | _setLabelBackgroundColor | _setLabelClass | _setLabelColor | _setLabelFont | _setLabelRepresentation |
Once
a default layout has been created, you can execute the frame and
the data widgets inside of the Data Form will display the associated column
values for the current row. The default layout has many uses. For example,
you can use the default layout as a starting point for the design of your
particular layout and customize it to fit your needs. Another example is
to use a Data Form to display different tables in run-mode. Each time a new
table is displayed in the Data Form a new default layout could be created
to represent the column from the new table.
When creating a default layout or when dragging a column from the Column Window onto a Data Form, a model column is represented by a combination of widgets, known as a widget representation. There are four ways a widget representation can be made and each is described below. In the descriptions, the widget that displays the column name or label is referred to as the label widget, and the widget that displays and accepts a value for the column is referred to as the data widget.
When creating a default layout, placement of the widget representations
can be either vertical (the default) or horizontal. This order can be set
in the Customize Form window or by calling the _setAttributes method.
After creating a new layout using one of the techniques mentioned above, you can modify that layout using all of the normal FRAME operations. The only limitation is that widgets cannot be moved or copied into or out of a Data Form.
In order to make any customizations to a layout, you must specify a DATAFORM entry in the Data Form Attributes window. Without a DATAFORM entry, your customizations are not available when you execute the frame and are lost when you end from the frame.
The Data Form allows you to create a custom layout quickly and easily without requiring an SCL program. Since the Data Form allows you to represent a model column as a widget, you can take advantage of special features of the widgets. They can perform self-validation of values, allow the user to enter values faster and more reliably, and also enhance the appearance of a layout.
These changes made to the default layout to create the custom layout below were easy to make and improved the look and feel of the frame. Also, this customized layout has multiple pages to help split up the information so that it is not so overwhelming to the user.
| Using the Column Window with Data Forms |
The Column Window enables you to create a new widget representation for a model's column, associate a model's column with an existing widget, make a computed column, and disassociate a model's column from an existing widget. The Column Window can be displayed in one of two ways:
| Form |
| Display Column Window |
Only one Column Window is present (displayed) at any one time. If you have multiple instances of a Data Form, a Form Editor, or a subclass of a Form Editor, in the same frame or multiple frames, then the Column Window displays the columns from the active Data Form along with that Data Form's name in the list box title. The column window automatically closes when the last frame that contains a data form, a form editor, or a subclass of the form editor, closes.
The Column Window enables you to perform several actions on a Data Form by using drag and drop between the Column Window and the Data Form. Drag the column from the Column Window onto the Data Form. You will notice as you drag the column across the Data Form or any of it's widgets, the region border changes to the NOTE color, indicating valid drop sites. The drop highlight action and color is controlled from the Customize Form window. Releasing the mouse button while either the Data Form or one of its widget's borders is still the NOTE color, finishes the drag and drop operation and the appropriate action will take place as defined below.
The purpose of the Column Window and the linking of columns to widgets
is to allow the execution of labels within the model SCL. Each time a widget
that is linked to a column is modified, the new value is sent to the model
which executes the label corresponding to the name of the column linked to
that widget. Without linking columns to widgets, the user could not view or
edit the values of the column, nor could the developer add code to the model
SCL to perform an action based on a user-entered column value.
To create a new widget representation, drag the column onto the Data
Form and release the mouse button when the Data Form's region is the NOTE
color. This creates a default widget representation based on the current
Data Form settings at the location of your mouse pointer.
Instead of creating a default widget representation, you can make any
widget inside the Data Form (for example, a Radio Box or an Input Field) and
then associate a model column to that widget. After you create a widget inside
of the Data Form, drag a column and release the mouse button when the region
border of a widget inside the Data Form is the NOTE color. By performing
this action, the widget is now linked to the model column that was dropped
on it. Once linked, the widget displays the current row value of the linked
column during run-mode.
If you no longer want a model column linked to a widget within the Data
Form, drag and drop the
Unlink Object item onto the widget
in the Data Form. When you release the mouse button, the widget is no longer
linked to a model column. In run mode, the widget's value will no longer reflect
the current row value of the previously linked model column.
As mention above, a modified widget inside Data Form does not execute any labeled section in the model SCL unless it is linked to a column, either a real or computed column. The Make Computed Column item allows you to quickly create a computed column which is then automatically linked to the widget it was dropped on.
The name of the computed column will be the name of the widget, unless that name already exists. If the name exists, a number is appended to the name of the widget to create a unique name, for example RADIO1, RADIO2, etc. The name of the computed column now displays in the column window. When the widget associated with the computed column is modified, the labeled section that you have added to the model SCL, and which corresponds to the name of the computed column, executes.
The type of the computed column is the same as the type for the widget.
Each of the actions mentioned in the previous sections can be performed without doing drag and drop operations; instead simply issue a command. Click in an empty section of the Data Form to make it the active object. Use the following command and substitute any of the column names appearing in the Column Window for the 'column-name' argument:
LINK widget-name column-name
To disassociate a column from a widget, issue the following command to the Data Form:
UNLINK widget-name
| Data and Label Widgets |
The widgets inside a Data Form can be divided into three categories:
When data and label widgets are internally linked, we will use the text of the column name or column label for the text of the label widget instead of any changes to the text you make at the widget level. This also applies if you display the label text as a region title.
The Data Form calls the following methods to get and set attributes of both the label and data widgets.
| _getBackgroundColor | _setBackgroundColor | _getColor | _setColor | _getFont | _setFont | _getFormat | _setFormat | _getInformat | _setInformat | _getJustify | _setJustify |
If a method is not defined for a particular widget class, then that attribute is neither set nor retrieved. The attributes that are set for the data and label widgets are controlled by the Data Set Data Model. A model can have a set of attribute values that are specific to a particular column. If the column linked to a data or label widget has any attribute values specifically set, then those values take precedence over the default attribute values of the Data Form. For example, if a model column has a background color specified, then that color is used instead of the default background color of the Data Form. Otherwise, the Data Form default attribute value will be used.
The Data Form has default attribute values for the data background and foreground color and font as well as similar settings for the label. The Data Form does not have default settings for the format, informat, or justification attributes, so these attributes are not set unless the model specifies them. The _get methods listed are used to query the attributes from the data or label widgets that you have set in the widget's attribute window.
Note: The Data Form calls the _setData method to set the widget's value
to the value of the linked model column. The Data Form calls the _getData
method to retrieve the widget value modified by the user to be stored in the
linked model column. These methods are called on all data widgets and are
crucial for every data widget. Without the _setData and _getData methods,
the data widgets could not display or retrieve changes made to linked model
columns. The widgets supplied by SAS/AF software each have a _setData and
_getData method defined, but if you create your own widget subclass, you must
define a _getData and a _setData method for it in order to use that widget
subclass in a data form. ![[cautend]](../common/images/cautend.gif)
| Pages |
The contents of a Data Form layout can be split into units called pages. If a model has more columns than will fit on the initial page, other pages are added to display those model columns. You may also decide to add additional pages. Pages allow you to
The Data Form has no limit on the number of pages it can have, nor is there a limit on the number of widgets per page. You are only limited by the resources available on your system. A model column may be linked to a widget on more than one page. But realistically, you should limit the number of pages and widgets per pages since the more pages and widgets per page you have, the longer it takes for the frame to display.
The scroll bars, when active, allow you to scroll within the current page, not between pages or rows. Because the scroll bars scroll within a page, the page can be as large as you like. During the creation of a default layout, the page size is set to the size of the Data Form's region size. This size can be changed by scrolling down or to the right and adding widgets. Any page customizations that are done, are stored in the DATAFORM entry. DATAFORM entries can be used interchangeably between Data Forms; so if a new Data Form is smaller than the original Data Form, the scroll bars will allow you to view the entire contents of the pages.
During build mode, the scroll bars have no boundary, which enables you
to place widgets anywhere within a page. During run mode, scroll bars enable
you to scroll only to the lowest and right-most widget on the current page.
All Data Form layouts have at least one page. The Data Form allows you to add pages via the build mode pop-up menu items,
| Add page after current |
| Add page before current |
You can delete any page from a layout by selecting the build mode pop-up menu item
| Delete Page... |
When a Data Form layout has multiple pages, users can navigate between the pages in order to view and enter the data. There are several ways that this can be done:
You can control the display of earmarks from the Customize Form window or by calling the _setAttributes method and passing an item of EARMARK with a value of 'Y' or 'N'. The color of the earmarks can also be controlled from the attribute screen or by calling _setEarmarkColor or _setEarmarkOutlineColor.
| Pop-up Menus for Data Form |
When you use the pop-up menu button of your mouse to open the standard build-mode widget pop-up menu, the following two items are added to the build-mode pop-up menu for the form. The other items in the build-mode pop-up are described in the Widget Class.
Once the Column Window is displayed, it remains displayed until one of the following happens:
To compile this SCL, issue the COMPILE command from the EDIT SCL window
The Refill using attributes... pop-up item is used when you want to completely start over as if you were creating a new Data Form from scratch along with a default layout.
NOTE: The object 'object-name' is linked to column
'column-name'.
If you click a widget that is not linked to a column, you see the following message displayed on the message line:
When you use the pop-up menu button of your mouse to display the build-mode pop-up menu for any widgets inside the Data Form, the following three items are added to the build-mode pop-up menu for the widget.
You can use your mouse to display a pop-up menu in run mode. To turn off the run-mode pop-up menu, select Command Processing from the Form Editor Attributes window. Then, select Honor General Attribute from the Popmenu Processing list box.
The menu items specific to the Data Form class are defined as follows.
The row navigation menu items call the _vscroll method with the appropriate parameters for the requested command.
![]() Chapter Contents |
![]() Previous |
![]() Next |
![]() Top of Page |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.