gSlider
| Definition: |
include xpGUI.e
gdx id = gSlider([nullable_string orientation=NULL, ] [rtn value_changed=NULL, ] string attributes="", dword_seq args={}) |
| Description: |
Creates a slider control, which selects a value within a limited interval. Also known as a scale or trackbar in some native systems,
and pGUI called it an IupValuator or IupVal.
orientation: optional orientation of slider. Can be NULL (defaults to HORIZONTAL), see ORIENTATION below. value_changed: a procedure identifier, see VALUE_CHANGED below. For more information on the attributes and args parameters see gSetAttributes(). This is a paranormalised function (see technicalia). Returns: the identifier of the created element. |
| pwa/p2js: | Supported. |
| Example: |
-- demo\xpGUI\gSlider.exw
include xpGUI.e
constant title = "Slider"
procedure value_changed(gdx id)
gdx dlg = gGetDialog(id)
atom v = gGetAttribute(id,"VALUE")
gSetAttribute(dlg,"TITLE","%s:%g",{title,v})
end procedure
gdx slider = gSlider(value_changed,"SIZE=220x30"),
vbox = gVbox({slider},"MARGIN=9x9"),
window = gDialog(vbox,title,`SIZE=240x80`)
gShow(window)
gMainLoop()
|
| Attributes: | |
| ? INVERTED | Invert the minimum and maximum positions on screen. When INVERTED=YES maximum is at top and left (minimum is bottom and right), when INVERTED=NO maximum is at bottom and right (minimum is top and left). The initial value depends on ORIENTATION passed as parameter on creation, if ORIENTATION=VERTICAL default is YES, if ORIENTATION=HORIZONTAL default is NO. (since 3.0) |
| ? MAX+ | The maximum value, default 100. |
| ? MIN+ | The minimum value, default 0. |
| ? SIZE | (non inheritable) The initial size is 100 pixels along the major axis, and the handler normal size on the minor axis. If there are ticks then they are added to the natural size on the minor axis. The handler can be smaller than the normal size. Set to NULL to allow the automatic layout use smaller values. |
| ? ORIENTATION+ | (non inheritable) Informs whether the valuator is "VERTICAL" or "HORIZONTAL". Vertical valuators are bottom to up, and horizontal valuators are left to right variations of min to max (but can be inverted using INVERTED). Default: "HORIZONTAL". |
| VALUE | A number between MIN and MAX, indicating the current position, default 0. |
| also | ACTIVE, CANFOCUS, EXPAND, FONT, MINSIZE, MAXSIZE, TIP, SIZE, VISIBLE. |
| Handlers: |
|
| VALUE_CHANGED |
Called after the value was interactively changed by the user.
procedure value_changed(gdx id) id: identifier of the element that activated the event. |
| also |
KEY: All common handlers are supported. |