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

hiCreateBooleanButton

hiCreateBooleanButton(
?name s_fieldName 
?buttonText t_buttonText
[ ?buttonLocation s_buttonLocation ]
[ ?callback g_callback ]
[ ?value g_booleanValue ]
[ ?defValue g_defaultValue ]
[ ?help g_fieldHelp ] 
[ ?font t_font ] 
[ ?enabled g_enabled ]
[ ?invisible g_invisible ]
[ ?partialSelect g_partialSelect ]
) 
=> r_fieldHandle

Description

Creates a single Boolean button for a form. The button text appears as a prompt next to the button; the button is on the left of the button text if the ?buttonLocation argument is ’left and on the right of the button text if the ?buttonLocation argument is ’right. A Boolean field consists of a single toggle button which may have an associated callback procedure executed when the Boolean state changes.

For efficiency, Boolean buttons should always be used in preference to single toggle buttons.

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.

Arguments

?name s_fieldName

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

formHandle->hiFieldSym

?buttonText t_buttonText

  

Prompt string which appears next to the toggle button.

?buttonLocation s_buttonLocation

  

’left or ’right

Default value: ’right

Specify ’left if you want the button to appear on the left of the button text; specify ’right if you want the button to appear on the right of the button text.

If the prompt box width is not specified and the button is on the right, the button is right justified in the field. If the prompt box width is not specified and the button is on the left, the button text on the right is not right justified; instead, it is placed as if the prompt box width were set to 20. (The prompt box width is a two-dimensional attribute you can specify when you create the form.)

In one-dimensional forms, the button text is always on the left; the ?buttonLocation argument is ignored.

?callback g_callback

  

A string, function object, or symbol type callback. The callback is called as soon as the button state changes.

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.

When the callback is either symbol type or string type, it only passes one argument, t or nil.

In case the callback is string type and contains parentheses, such as "MyCallback()" then no argument is passed (other than what is specified in the string, if any)

If the callback is object type, then the syntax used is <Boolean button callback> (o_field  g_scope  g_value)

?value g_booleanValue

  

Specifies the value of a boolean button.

The valid values are: t, nil, or partial. The default value is nil.

The partial value can be specified only when ?partialSelect is set to t.

?defValue g_defaultValue

  

Optional default value of the field. 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.

?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.

?partialSelect g_partialSelect

Enables a new visual state of a boolean button by providing indeterminate checks to the checkboxes. The default value is nil.

Values Returned

r_fieldHandle

Handle to the Boolean button.

Examples

;****************************************
;Sample form and fields
;****************************************
; Create string entry for the form. 
procedure( myformDefineFields()
  strfldglb = hiCreateStringField(
    ?name `strfldglb
    ?prompt "sample string field"    ;;; FIELD1, a string type
    ?defValue "initial string"
    ?callback "my_strfldglb_cb()"
    ?editable t
)
  ; Create a Boolean button for the form. 
  boolfldglb = hiCreateBooleanButton(
    ?name `boolfldglb
    ?buttonText "sample boolean field"        ;;; FIELD2, a boolean type
    ?defValue t
    ?callback "my_boolfldglb_cb()"
  )
  list( strfldglb boolfldglb )
)
; 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
)
; Display the form
procedure( myformdisplayform()
  myformcreateform()    ;;; Creation and Display are separate
  hiDisplayForm(`myformglb)
)
; Check the current state of the form
hiIsFormDisplayed(myformglb) =>nil
myformdisplayform()
hiIsFormDisplayed(myformglb) 
=>t

Related Topics

Form and Field Functions

Creating Context Menus for Fields


Return to top
 ⠀
X