# nodesnim/nodescontrol/slider

Dark Mode

Search:
Group by:

It provides primitive horizontal slider.

# Imports

../thirdparty/opengl, ../core/vector2, ../core/rect2, ../core/anchor, ../core/input, ../core/color, ../core/enums, ../nodes/node, control

# Types

    SliderObj = object of ControlRef
      max_value*, value*: uint
      progress_color*: ColorRef
      thumb_color*: ColorRef
      on_changed*: proc (self: SliderRef; new_value: uint): void

    SliderRef = ref SliderObj

# Procs

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

  Creates a new Slider.

  Arguments:

  - `name` is a node name.

  Examples:

      var sc = Slider("Slider")

# Methods

    method draw(self: SliderRef; w, h: GLfloat) {...}{.raises: [GLerror, Exception],
                                            tags: [RootEffect].}

  This uses in the `window.nim`.

    method duplicate(self: SliderRef): SliderRef {...}{.base, raises: [], tags: [].}

  Duplicates Sider object and create a new Slider.

    method setMaxValue(self: SliderRef; value: uint) {...}{.base, raises: [], tags: [].}

  Changes max value.

    method setProgress(self: SliderRef; value: uint) {...}{.base, raises: [], tags: [].}

  Changes progress.

    method setProgressColor(self: SliderRef; color: ColorRef) {...}{.base, raises: [], tags: [].}

  Changes progress color. For change background color use `setBackgroundColor` method.

    method handle(self: SliderRef; event: InputEvent; mouse_on: var NodeRef) {...}{.
        raises: [Exception], tags: [RootEffect].}

  Handles user input. This uses in the `window.nim`.