GUILayoutButtonsToggle Method |
Makes a toggle control that fires a callback when the state changes.
Namespace:
KSPDev.GUIUtils
Assembly:
KSPDev_Utils.2.0 (in KSPDev_Utils.2.0.dll) Version: 2.0 for KSP v1.8+
Syntaxpublic static bool Toggle(
bool btnState,
GUIContent guiCnt,
GUIStyle style,
GUILayoutOption[] options,
Action fnOn,
Action fnOff,
GuiActionsList actionsList = null
)
Request Example
View SourceParameters
- btnState
- Type: SystemBoolean
The current toggle state. - guiCnt
- Type: GUIContent
The GUI content to present as the button's caption. - style
- Type: GUIStyle
The GUI style of the control. - options
- Type: GUILayoutOption
The GUILayout options to apply to the control. It can be null.
- fnOn
- Type: SystemAction
The callback to call when the control is checked. Can be null.
- fnOff
- Type: SystemAction
The callback to call when the control is checked. Can be null.
- actionsList (Optional)
- Type: KSPDev.GUIUtilsGuiActionsList
The action list to execute the callbacks thru. If the list is omitted, then the callback is
fired right away. Otherwise, it's added to the list and executed when the list is triggered.
Return Value
Type:
BooleanThe new button toggle state.
Remarks
The callbacks are only fired once for every state change, and are guaranteed to not be called
during the layout phase. The callback is called *after* the state is updated.
See Also