kmx > IUP-0.006 > IUP::Val

Download:
IUP-0.006.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: IUP-0.202

NAME ^

IUP::Val - [GUI element] selects a value in a limited interval (aka scale, trackbar)

DESCRIPTION ^

Creates a Valuator control. Selects a value in a limited interval. Also known as Scale or Trackbar in native systems.

Motif Windows
Classic
Windows
w/ Styles
Windows
Vista
GTK

USAGE ^

CREATION - new() method

 $val = IUP::Val->new( ORIENTATION=>"VERTICAL" );

Returns: the identifier of the created element, or undef if an error occurs.

NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.

ATTRIBUTES

For more info about concept of attributes (setting/getting values etc.) see IUP::Manual::03_Attributes. Attributes specific to this element:

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.

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.

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 undef 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.

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".

The following common attributes are also accepted:

CALLBACKS

For more info about concept of callbacks (setting callback handlers etc.) see IUP::Manual::04_Callbacks. Callbacks specific to this element:

VALUECHANGED_CB

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:

NOTES ^

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.

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 is slightly different from the defined by the native systems (Home and End keys are different). But it is the same in all systems.

EXAMPLES ^

The element IUP::Val is used in the following sample scripts:

SEE ALSO ^

The original doc: iupval.html

syntax highlighting: