Expand/Shrink

IupValuator

Definition: include pGUI.e

Ihandle ih = IupValuator(nullable_string orientation=NULL, [[nullable_string action=NULL,] cbfunc func=NULL,] string attributes="", dword_seq args={})
Description: Creates a Valuator control. Selects a value in a limited interval. Also known as Scale, Slider, or Trackbar in native systems.

orientation: optional orientation of valuator. Can be NULL. See ORIENTATION attribute.
action: Name of the action specified by func, defaults to "ACTION" (you probably need "VALUECHANGED_CB"), ignored if func is NULL.
func: a callback address, usually specified as Icallback("name").
For more information on the attributes and args parameters see IupSetAttributes.
This is a paranormalised function.

Returns: the identifier of the created element.
pwa/p2js: Supported, but see +x? markers on individual attributes and callbacks.
See Also: IupFlatValutor, IupGLValutor
Notes: In Motif, after the user clicks the handler a KILLFOCUS will be ignored when the control loses its focus.

Keyboard Mapping
This is the default mapping when INVERTED has the default value, or ORIENTATION=HORIZONTAL+INVERTED=NO.

Keys Action for HORIZONTAL
Right Arrow move right, increment by one step
Left Arrow move left, decrement by one step
Ctrl+Right Arrow or PgDn move right, increment by one page step
Ctrl+Left Arrow or PgUp move left, decrement by one page step
Home move all left, set to minimum
End move all right, set to maximum

This is the default mapping when INVERTED has the default value, or ORIENTATION=VERTICAL+INVERTED=YES.

Keys Action for VERTICAL
Up Arrow move up, increment by one step
Down Arrow move down, decrement by one step
Ctrl+Up Arrow or PgUp move up, increment by one page step
Ctrl+Down Arrow or PgDn move down, decrement by one page step
Home move all up, set to maximum
End move all down, set to minimum

Visually all the keys move to the same direction independent from the INVERTED attribute.

Semantically all the keys change the value depending on the INVERTED attribute.

This behavior differs slightly from the native controls (Home and End keys are different). But it is the same in all systems.

Invokes the C function IupVal. In pGUI, IupVal() and IupValuator() are identical; use whichever you prefer. I felt there was something a little ambiguous about "IupVal" (eg value/valid), whereas "IupValuator" should cause fewer false assumptions.

An example can be seen in demo\pGUI\sample.exw
Attributes:
BGCOLOR transparent in all systems except in Motif. It will use the background color of the native parent.
CANFOCUS? (creation only) (non inheritable) enables the focus traversal of the control. In Windows the control will still get the focus when clicked. Default: YES. (since 3.0)
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+ Contains the maximum valuator value. Default is "1". When changed the display will not be updated until VALUE is set.
MIN+ Contains the minimum valuator value. Default is "0". When changed the display will not be updated until VALUE is set.
PAGESTEP? Controls the increment for pagedown and pageup keys. It is not the size of the increment. The increment size is "pagestep*(max-min)", so it must be 0<pagestep<1. Default is "0.1".
RASTERSIZE+ (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.
SHOWTICKS [Windows and Motif Only] The number of tick marks along the valuator trail. Minimum value is "2". Default is "0", in this case the ticks are not shown. It can not be changed to 0 from a non zero value, or vice-versa, after the control is mapped. GTK does not support ticks.
STEP+ Controls the increment for keyboard control and the mouse wheel. It is not the size of the increment. The increment size is "step*(max-min)", so it must be 0<step<1. Default is "0.01".
TICKSPOS [Windows Only] (creation only) Allows to position the ticks in both sides (BOTH) or in the reverse side (REVERSE). Default: NORMAL. The normal position for horizontal orientation is at the top of the control, and for vertical orientation is at the left of the control. In Motif, the ticks position is always normal. (since 3.0)
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+ (non inheritable) Contains a number between MIN and MAX, indicating the valuator position. Default: "0.0".
also ACTIVE, EXPAND?, FONT, NAME, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP?, SIZE+, ZORDER, VISIBLE: also accepted.
Callbacks: (the names of callback routines are suggestions only)
VALUECHANGED_CB Called after the value was interactively changed by the user.

function valuechanged_cb(Ihandle ih)
ih: identifier of the element that activated the event.

[PL: moved from notes:] This control replaces the old IupVal implemented in the additional controls.
The old callbacks are still supported but called only if the VALUECHANGED_CB callback is not defined.
The MOUSEMOVE_CB callback is only called when the user moves the handler using the mouse.
The BUTTON_PRESS_CB callback is called only when the user press a key that changes the position of the handler.
The BUTTON_RELEASE_CB callback is called only when the user releases the mouse button after moving the handler.
also MAP_CB, UNMAP_CB, DESTROY_CB, GETFOCUS_CB, KILLFOCUS_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB, K_ANY, HELP_CB: All common callbacks are supported.