Product Documentation
Cadence User Interface SKILL Reference
Product Version IC23.1, September 2023

hiCreateFloatField

hiCreateFloatField( 
?name s_fieldName 
[ ?value f_currentValue ]
[ ?acceptNil g_acceptNil ]
[ ?prompt t_fieldPrompt ] 
[ ?defValue f_defaultValue ] 
[ ?help g_fieldHelp ] 
[ ?font t_font ] 
[ ?callback g_callback ] 
[ ?modifyCallback g_modifyCallback ]
[ ?focusInCallback g_focusInCallback ]
[ ?range l_fieldRange ] 
[ ?format t_fieldFormat ] 
[ ?editable g_editable ] 
[ ?enabled g_enabled ]
[ ?invisible g_invisible ]
[ ?nextField g_nextField ]
) 
=> r_fieldHandle

Description

Creates a float field for a form. A float field is a field which accepts floating-point input only. A format string can be specified which is automatically imposed on any user input. An optional range can be specified and enforced for this field as well.

This field can also have a context menu, that is, a pop-up menu that is displayed when you right-click on the field.

For information on creating tooltips for fields, see Creating Tool Tips for Fields.

You can also override the default floating point format specification for all hi float fields by setting the following variable in your .cdsenv file:

ui defaultFloatFieldFormat string "format"

If this variable is not set, float fields have a default format specification of "%.6g", which displays the value to six significant digits.

Arguments

?name s_fieldName

Handle to this field within a form. To reference it, use:

formHandle->hiFieldSym

?value f_currentValue

  

Initial and current value of this field. It is a required parameter, and may be referenced as:

formHandle->hiFieldSym->value

?acceptNil g_acceptNil

  

If set to t, the field accepts nil as a value. If there is no value entered for the field on the form, it results in the SKILL value being set to nil. Setting a field value to nil using the CIW results in the field on the form to be blank.

?prompt t_fieldPrompt

  

String specifying the prompt for the field. To reference it, use:

formHandle->hiFieldSym->prompt

?defValue f_defaultValue

  

Optional, default value of the field (in the correct format). This value is equal to the initial entry in currentValue if defaultValue is not specified. To reference the default value, use:

formHandle->hiFieldSym->defValue

?help g_fieldHelp

A string or symbol used to reference help. If not specified, s_fieldName is used. This argument is currently not used.

?font t_font

A font argument is accepted but not supported at this time.

?callback g_callback

  

Callback of string, symbol, or function object type. The callback is called when the field has “lost focus” (when the cursor leaves the form, the user tabs to another field, and so forth) or when the user selects any button in the form.

If the callback is of string type, you can specify one or more SKILL functions or even multiple SKILL statements that should be executed when the value of the field changes.

?modifyCallback g_modifyCallback

  

Do not use the g_modifyCallback argument with this field because it may not work as expected. Use this argument only with string fields.

SKILL function to be executed whenever any change is made in the text field, for example, by typing or pasting. The modify callback is called when a change is detected in the field but before the change is displayed.

The modify callback function is passed the following arguments:

s_fieldName t_latestTextValue g_sourceOfChange

where s_fieldName is the symbol of the field in which the change was made, t_latestTextValue is the latest text value of the field, and g_sourceOfChange is t or nil where t indicates that the change was made programmatically (by changing the value of the field) and nil indicates that the change was made by a user action.

The modify callback function should return the following:

t | nil | value

If the modify callback function returns t, the changes made to the field are allowed and are displayed as they are entered. If the function returns nil, the changes made to the field are not allowed and are not displayed—the original value of the field is retained. If the function returns some other value, it must be a floating point. This value replaces the current value of the field.

?focusInCallback g_focusInCallback

  

SKILL function to be executed whenever the field comes into focus. You provide this function, which could be of string, symbol, or function object type.

?range l_fieldRange

  

Optional list containing the minimum and maximum float values. For example, the list (0.5 10.9), also specified as 0.5:10.9, represents the range of floats from 0.5-10.9 inclusive. To specify an unbounded upper range, use either nil or the string "infinity" as the second value. To specify an unbounded lower range, use either nil or the string "-infinity" as the first value.

?format t_fieldFormat

  

Optional string that can control the display of the value on the form. It is similar to printf.

Acceptable format characters are those allowed by the C programming language.

?editable g_editable

  

If set to nil, the field is read-only; setting g_editable to t makes the field editable.

?enabled g_enabled

  

Specifies whether the fields in the layout are enabled. The default value is t.

?invisible g_invisible

  

Specifies whether the layout and the fields within are invisible. The default value is nil.

?nextField g_nextField

  

Symbol or string indicating the next field to bring into focus when the Tab key is pressed. If you specify nil or do not specify this argument, the Tab traversal order is determined by the tabOrderIsAddOrder argument of hiCreateAppForm or hiCreateScrollRegion. If the tabOrderIsAddOrder argument is not set or if its value is nil, the default traversal order is based on the form layout —left-to-right and top-to-bottom— beginning with the field at the top-left corner of the form.

Value Returned

r_fieldHandle

Handle to the float field.

Related Topics

Form and Field Functions

Creating Context Menus for Fields


Return to top
 ⠀
X