nodesnim/nodescontrol/checkbox

Types

ToggleHandler = proc (self: CheckBoxRef; toggled: bool)
CheckBoxRef = ref object of ControlRef
  enabled*: bool
  check_color*: ColorRef
  box: DrawableRef
  text*: StyleText
  text_align*: AnchorObj
  on_toggle*: ToggleHandler  ## This called when switch toggled.
  

Lets

toggle_handler: ToggleHandler = proc (self: CheckBoxRef; toggled: bool) = discard

Procs

proc CheckBox(name: string = "CheckBox"): CheckBoxRef {...}{.raises: [], tags: [].}

Creates a new CheckBox.

Arguments:

  • name is a node name.

Example:

var text = CheckBox("CheckBox")

Methods

method disable(self: CheckBoxRef) {...}{.base, raises: [Exception],
                                    tags: [RootEffect].}
method draw(self: CheckBoxRef; w, h: GLfloat) {...}{.
    raises: [GLerror, Exception, ResourceError], tags: [RootEffect].}
This uses in the window.nim.
method duplicate(self: CheckBoxRef): CheckBoxRef {...}{.base, raises: [], tags: [].}
Duplicates ChechBox object and create a new ChechBox.
method enable(self: CheckBoxRef) {...}{.base, raises: [Exception], tags: [RootEffect].}
method setText(self: CheckBoxRef; value: string; save_properties: bool = false) {...}{.
    base, raises: [GLerror], tags: [].}
method toggle(self: CheckBoxRef) {...}{.base, raises: [Exception], tags: [RootEffect].}
method handle(self: CheckBoxRef; event: InputEvent; mouse_on: var NodeRef) {...}{.
    raises: [Exception], tags: [RootEffect].}
Handles user input. This uses in the window.nim.