OptionToggle Class — NXOpen Python API Reference 12.0.0 documentation

# OptionToggle Class

class `NXOpen.UIStyler.``OptionToggle`

  Bases: `NXOpen.UIStyler.StylerItem`

  Represents a OptionToggle for UI Styler

  New in version NX5.0.0.

# Properties

Property | Description
--- | ---
Visibility | Returns or sets the visibility

# Methods

Method | Description
--- | ---
AddActivateHandler | Registers activate callback.
AddValueChangedHandler | Registers value change callback.
Dispose | Free resources associated with the instance.
GetItemType | Gets the dialog item type.
GetItemValue | Returns item value
GetItems | Returns the items
GetSensitivity | Returns the sesitivity
InitializeAttachment | Returns initialized dialog item attachment information
IsEqualTo | Equates two styler items
SetAttachment | Specifies the updated dialog item attachment information
SetBitmaps | Set bitmaps
SetDefaultAction | Sets default action
SetItemValue | Sets item value
SetItems | Sets items in the array
SetLabel | Sets label
SetSensitivity | Set the sesitivity

# Property Detail

## Visibility

`OptionToggle.``Visibility`

  Returns or sets the visibility

  `-------------------------------------`

  Getter Method

  Signature `Visibility`

  Returns: |
  Return type: | bool

  New in version NX5.0.0.

  License requirements: None.

  `-------------------------------------`

  Setter Method

  Signature `Visibility`

  Parameters: | type (bool) – TRUE if visible, FALSE if invisible

  New in version NX5.0.0.

  License requirements: None.

# Method Detail

## AddActivateHandler

`OptionToggle.``AddActivateHandler`

  Registers activate callback.

  This method should be called before calling `UIStyler.Dialog.Show()` or `UIStyler.Dialog.RegisterWithUiMenu()`

  Signature `AddActivateHandler(activateevent, isDialogLaunchingEvent)`

  Parameters:

  - activateevent (CallableObject) – Callback for activate event
  - isDialogLaunchingEvent (bool) – TRUE if dialog is going to launch, FALSE if not

  New in version NX5.0.0.

  License requirements: None.

## AddValueChangedHandler

`OptionToggle.``AddValueChangedHandler`

  Registers value change callback.

  This method should be called before calling `UIStyler.Dialog.Show()` or `UIStyler.Dialog.RegisterWithUiMenu()`

  Signature `AddValueChangedHandler(valuechangedevent, isDialogLaunchingEvent)`

  Parameters:

  - valuechangedevent (CallableObject) – Callback for value changed event
  - isDialogLaunchingEvent (bool) – TRUE if dialog is going to launch, FALSE if not

  New in version NX5.0.0.

  License requirements: None.

## GetItemValue

`OptionToggle.``GetItemValue`

  Returns item value

  Signature `GetItemValue()`

  Returns: | a tuple
  Return type: | A tuple consisting of (itemVal, setCheck) itemVal is a int. Item value setCheck is a bool.

  New in version NX5.0.0.

  License requirements: None.

## GetItems

`OptionToggle.``GetItems`

  Returns the items

  Signature `GetItems()`

  Returns: | An array of items
  Return type: | list of str

  New in version NX5.0.0.

  License requirements: None.

## GetSensitivity

`OptionToggle.``GetSensitivity`

  Returns the sesitivity

  Signature `GetSensitivity()`

  Returns: |
  Return type: | bool

  New in version NX5.0.0.

  License requirements: None.

## SetBitmaps

`OptionToggle.``SetBitmaps`

  Set bitmaps

  Signature `SetBitmaps(bitmaps)`

  Parameters: | bitmaps (list of str) – An array of one or more bitmap filenames. If all bitmaps for the option menu reside in the same file, specify an array of just one entry, which contains the bitmap filename for this attribute. All existing choices for the option menu remain intact when this attribute is set. Only the bitmaps are changed. Note that the number of bitmaps must match the number of existing choices.

  New in version NX5.0.0.

  License requirements: None.

## SetDefaultAction

`OptionToggle.``SetDefaultAction`

  Sets default action

  Signature `SetDefaultAction()`

  New in version NX5.0.0.

  License requirements: None.

## SetItemValue

`OptionToggle.``SetItemValue`

  Sets item value

  Signature `SetItemValue(subitemIndex, setCheck)`

  Parameters:

  - subitemIndex (int) – Zero-based index indicating the choice to be selected. It must be in the range of existing choices.
  - setCheck (bool) – TRUE if set, FALSE if unset.

  New in version NX5.0.0.

  License requirements: None.

## SetItems

`OptionToggle.``SetItems`

  Sets items in the array

  Signature `SetItems(strListArray)`

  Parameters: | strListArray (list of str) – An array of new choices to be used for the dialog item. Note that this removes all existing choices (both text and bitmaps).

  New in version NX5.0.0.

  License requirements: None.

## SetLabel

`OptionToggle.``SetLabel`

  Sets label

  Signature `SetLabel(strLabel)`

  Parameters: | strLabel (str) – Text to be set for the tool tip.

  New in version NX5.0.0.

  License requirements: None.

## SetSensitivity

`OptionToggle.``SetSensitivity`

  Set the sesitivity

  Signature `SetSensitivity(subitemIndex, type)`

  Parameters:

  - subitemIndex (int) – If the entire dialog item should change to the new Sensitivity state, set this field to UF_STYLER_NO_SUB_INDEX. If only one sub-item should change to the new sensitivity state, set this field to its zero-based index.
  - type (bool) – TRUE if sensitive, FALSE if insensitive

  New in version NX5.0.0.

  License requirements: None.