IUP::Val - [GUI element] selects a value in a limited interval (aka scale, trackbar)
Creates a Valuator control. Selects a value in a limited interval. Also known as Scale or Trackbar in native systems.
$val = IUP::Val->new( ORIENTATION=>"VERTICAL" );
Returns: the identifier of the created element, or undef if an error occurs.
undef
NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.
new()
ATTRIBUTE=>'value'
CALLBACKNAME=>\&func
For more info about concept of attributes (setting/getting values etc.) see IUP::Manual::03_Attributes. Attributes specific to this element:
Transparent in all systems except in Motif. It will use the background color of the native parent.
(creation only) (non inheritable)
Enables the focus traversal of the control. In Windows the control will still get the focus when clicked. Default: YES.
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.
Contains the maximum valuator value. Default is "1". When changed the display will not be updated until VALUE is set.
Contains the minimum valuator value. Default is "0". When changed the display will not be updated until VALUE is set.
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".
(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 undef to allow the automatic layout use smaller values.
[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.
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".
[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.
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".
Contains a number between MIN and MAX, indicating the valuator position. Default: "0.0".
The following common attributes are also accepted:
ACTIVE, EXPAND, FONT, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, SIZE, ZORDER, VISIBLE
For more info about concept of callbacks (setting callback handlers etc.) see IUP::Manual::04_Callbacks. Callbacks specific to this element:
Called after the value was interactively changed by the user.
Callback handler prototype:
sub valuechanged_cb_handler { my ($self) = @_; #... }
$self: reference to the element (IUP::Val) that activated the event
The following common callbacks are also accepted:
MAP_CB, UNMAP_CB, GETFOCUS_CB, KILLFOCUS_CB, ENTERWINDOW_CB, LEAVEWINDOW_CB, K_ANY, HELP_CB
This control replaces the old IUP::Val 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 release the mouse button after moving the handler.
In Motif, after the user clicks the handler a KILLFOCUS will be ignored when the control loses its focus.
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 is slightly different from the defined by the native systems (Home and End keys are different). But it is the same in all systems.
The element IUP::Val is used in the following sample scripts:
0-basic/cbox.pl - IUP::Cbox example
0-basic/layoutdialog.pl - IUP::LayoutDialog example
0-basic/val.pl - IUP::Val example
1-apps/app-sample1.pl - example used for screenshot - IUP.pod
1-apps/app-sample2.pl - example based on the original sample.c
1-apps/app-simple-demo.pl - example used for screenshot - IUP.pod
The original doc: iupval.html
To install IUP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IUP
CPAN shell
perl -MCPAN -e shell install IUP
For more information on module installation, please visit the detailed CPAN module installation guide.