hiCreateAppForm
hiCreateAppForm(?names_name?fieldsl_fieldEntries[?attachmentListl_fieldAttachments] [?tabOrderIsAddOrderg_tabOrderIsAddOrder] [?formTitlet_formTitle] [?callbackg_callback] [?unmapAfterCBg_unmapAfterCB] [?mapCBg_mapCallback] [?formTypes_formType] [?dialogStyles_dialogStyle] [?buttonLayoutg_buttonLayout] [?buttonDisableds_buttonDisabled] [?helpg_help] [?initialSizeg_initialSize] [?minSizeg_minSize] [?maxSizeg_maxSize] [?dontBlockg_dontBlock] [?fieldFocuss_fieldFocus] [?plistg_plist] [?baseNames_baseName] ) =>r_form
Description
Returns the SKILL representation of a form with the specified field entries, setting it to the specified name. All standard forms, from simple forms to property lists, are generated using hiCreateAppForm, with varying field entries. Use this function instead of hiCreateForm.
Arguments
|
List of field descriptors returned from the field creation routines. You must use at least one field entry. There is no upper limit on the number of field entries you specify. By default, the fields appear in a column on the form, in the order in which they are listed. To manipulate the order and position of form fields, use two-dimensional attributes. If you use two-dimensional attributes, each field entry for l_fieldEntries is a list containing a field descriptor and the two-dimensional attributes for that field. For example, a field entry could be:
For details about two-dimensional attributes, see Two Dimensional Form Layout. If you are creating a form that supports field attachments (so that fields are automatically resized when you resize the form), you must specify two-dimensional attributes for each field entry in l_fieldEntries. |
|
|
List of field attachments. Field attachments determine how the two-dimensional attributes for a field are used to position that field in the form. The first field attachment is applied to the first field in l_fieldEntries, the second to the second field, and so forth. You must have the same number of attachments in l_fieldAttachments as the number of fields in l_fieldEntries. If you do not want to specify a field attachment for a field, use Each field attachment in l_fieldAttachments consists of a bitwise OR of a list of constants. Each constant is a specification for a side of the field (left, right, top, and bottom). These attachment specifications for the sides of a field can be positional or percentage attachments. For example, an l_fieldAttachments list could be:
For details about field attachments and how to use positional and percentage constants, see Field Attachments. If you use the field attachments argument, you must specify the following: |
|
|
The nextField property set on a field (to any non-nil value) overrides the g_tabOrderIsAddOrder value. |
|
|
Used to specify the SKILL functions (callbacks) that execute after you select Apply, OK, or Cancel in the form. g_callback can be in one of two formats: g_okAction specifies the SKILL function to be executed when the Apply, OK, Close, or Quit button is pressed in a form; g_cancelAction specifies the SKILL function to be executed when the Cancel button is pressed. Here, if g_cancelAction is not specified, no callback gets called when the form is canceled. Both g_okAction and g_cancelAction can be in one of the following formats: t_callback, s_callback, or u_callback
t_callback is the string representation of the SKILL function to be executed. If you specify t_callback, the string is evaluated and the callback function is not passed any argument. s_callback is the symbol of the SKILL function to be called. If you specify s_callback, the callback function is passed and the r_form returned from
After the form is instantiated, you can change the callback with the |
|
|
If set to |
|
|
Specifies the callback to be invoked when the form is mapped, that is, when |
|
|
Possible choices include ’ |
|
|
One of the following symbols, which determines the blocking behavior of the form: Blocks access to the application while it is displayed. The user must dismiss the form in order to continue using the application. (Access to window manager commands or other applications is not blocked.) Does not block access to the application. The user can continue using the application without having to close the form. |
|
|
Used to specify the buttons that appear at the bottom of the form. g_buttonLayout can be in one of the following formats: Displays a predefined set of buttons, followed by the Help button. You can select from a list of button layouts. Displays a predefined set of buttons, followed by your custom buttons and the Help button. Custom buttons are specified as button text/button callback pairs. Displays only your custom buttons, followed by the Help button. Custom buttons are specified as button text/button callback pairs.
Specify either OK, Close, or Quit as one of the button names in your list of custom buttons so the form can be closed. You can use Does not display any buttons in the form.
The form can be closed either through the window manager or by calling s_buttonLayout specifies a predefined set of buttons. The Help button is automatically added with each of these combinations. Select one of the following button layouts: |
|
|
|
|
|
If there is no Cancel button on a form but there is a Close or Quit button, when you close the form from the window manager or by typing
hiFormCancel in the CIW, hiFormDone is called.
For custom buttons, following s_buttonLayout or ’
’ s_customButtonText is the symbol whose printname is the button text. For example, to have a button "Press Me", s_customButtonText would be specified as ’Press\ Me.
s_customButtonCB is the callback for the button and can be specified as a symbol or string. If it is a symbol, the callback function is passed and r_form returns from
Pressing Enter, |
|
|
’
You can also customize this feature by specifying the button that you want to link to Enter. You do this setting the following environment variable in your
where value is the buttonText of the button that you want to link to <Enter>. When this variable is set, the g_buttonLayout argument is searched for the button whose text equals the value of the variable. The first button that is found becomes the default button. If the specified value is not found in g_buttonLayout, then <Enter> performs the same action as the first button of the form button list. |
|
|
List of buttons that are disabled when the form appears. You can change this value with the |
|
|
Specify g_help as a single string, single symbol, list of strings, or list of symbols that is to be used to reference a
If you specify a single string or symbol, it is used to set the
(If you want to specify the help symbol only, specify a list of two strings or symbols, with nil as the first element of the list and the help symbol as the second element. This sets the
When a user clicks Help on the form, the
If the
The
You can also use the |
|
|
The size of the form when it first appears. g_initialSize accepts the following values:
If you are creating a form that supports field attachments (so that fields are automatically resized when you resize the form), you must specify the g_initialSize argument and it must be a list of width and height. For forms that have field attachments, the initial size value is used only for the field area and excludes the button area. For forms that do not have field attachments, the initial size is interpreted as including the button area. The area required for the scroll bar is never part of the intial size. |
|
|
The minimum size of the form, specified as a list of width and height or width:height. The minimum size excludes the window manager’s title and border. The default minimum width is a few pixels wider than the width of the button banner and the default minimum height is a few pixels more than the height of the button banner.
To change the minimum size, use the |
|
|
The maximum size of the form, specified as a list of width and height or width:height. The maximum size excludes the window manager’s title and border. The default maximum size is the size of the screen.
To change the maximum size, use the |
|
|
If set to
If set to
Prior to the 9504 release, |
|
|
Optional argument used to determine which type-in fields can accept focus through tabbing or clicking the mouse. Possible choices are ’
If set to ’ |
|
|
If specified, it indicates that the form name is to be used for help. |
|
Values Returned
Examples
This example shows how to re-display a form that has already been created. It also shows how to set defaults:
;****************************************
;Sample form and fields
;****************************************
; Create string entry for the form.
procedure( myformDefineFields()
let((strfld boolfld)
strfld = hiCreateStringField(
?name 'strfld
?prompt "sample string field" ;;; FIELD1, a string type
?defValue "initial string"
?callback "my_strfld_cb(hiGetCurrentForm())"
?editable t
)
; Create a Boolean button for the form.
boolfld = hiCreateBooleanButton(
?name 'boolfld
?buttonText "sample boolean field" ;;; FIELD2, a boolean type
?defValue t
?callback "my_boolfld_cb(hiGetCurrentForm())"
)
list( strfld boolfld )
)
)
; Generate the form
procedure( myformCreateForm()
if( !boundp(`myformglb) || (myformglb == nil)
then
myformglb = hiCreateAppForm(
?name `myformglb
?fields myformDefineFields()
?formTitle "My first Form"
?callback 'myformglb_cb
?buttonLayout `OKCancel
)
)
myformglb
)
procedure(myformglb_cb(form)
printf("Field values are: %s and %L\n" form->strfld->value form->boolfld->value)
)
procedure(my_strfld_cb(form)
printf("String field changed to %s\n" form->strfld->value)
)
procedure(my_boolfld_cb(form)
printf("Boolean field changed to %L\n" form->boolfld->value)
)
; Display the form
procedure( myformDisplayForm()
myformCreateForm() ;;; Creation and Display are separate
hiDisplayForm(`myformglb)
)
myformDisplayForm()
-
Invoking
myformdisplayform()displays the above form. If you dismiss the form, the form disappears but the object still remains. -
To redisplay the form use
hiDisplayForm('myformglb). -
If you modify some fields on the form, you can restore the default field settings using
hiFormDefaults.('myformglb)
Additional Information
When you create a form field, f all arguments are valid, the internal data structure for a field is returned; otherwise nil is returned. The following routines create fields for a form. Each of these routines returns a field descriptor which should be assigned to a user-specified symbol. These symbols are then used as arguments to the hiCreateAppForm routine.
The symbol each field descriptor is assigned to may be any arbitrary global symbol. Once these have been passed to the hiCreateAppForm function, it is no longer reliable to reference field data through these global symbols. You should then use the formSymbol->fieldSymbol notation, where fieldSymbol is the symbol passed as the ?name argument to the field creation routines.
The following form field creation routines are available:
| Fields | SKILL functions |
|---|---|
Related Topics
Return to top