mrwidget_numfield.pro
mrWidget_numfield
Syntax:
widget_id = mrwidget_numfield( parent, /integer, /float, /editable
. value=number, min=number, max=number, incr=number,
. xsize=int, labeltext=string, labelsize=int, fieldsize=int, frame=int,
. uname=string, uvalue=var, /all_events, format=format
Return value:
The widget id of the created compound widget or 0L in case of errors.
Arguments:
parent
widget_id of the parent widget
integer
value is of integer type (default>
float
value is of float type
editable
Determines wether the value field is directly editable. Default is no (=0)
value
the initial value, default is 0.
min
minmimum allowed value
max
maximum allowed value
incr
increment/decrement value for the arrow buttons. Default is 1.
xsize
xsize in pixels of the widget. Please note that labelsize + fieldsize
should be about 22 pixels less than xsize, or the up/down arrows will
not be displayed!
labeltext
text of the label
labelsize
size of the label in pixels
fieldsize
size of the input field in pixels - don't use characters because then
the fieldsize in pixels will depend on the font
frame
if set, draws a frame around the widget
uname
user definable name to identify this widget. See any other IDL widget
documentation for more info
uvalue
user definable value
format
A format string as accepted by idl, e.g. '(f4.2)' that denotes the format
of the output. This format string is applied whenever the user
a) presses one of the arrow buttons
b) presses return
c) inserts a digit which would result in a number outside possibly specified
boundaries. The default formats are '(i8)' for integer and '(f12.5)' for float.
all_events
By default, any value change in the text field will cause a corresponding
event, the keyword here being value change - i.e. removal of e.g.
a leading zero will not cause an event.
If all_events is set to '0', the user has to explicitly type
return to cause a value change event - but even then events are only caused
if the value has changed, i.e. two return keys cause only one event.
Mouse button presses on the arrows however always cause a change event.
Description:
A compound widget for integer or float value input with two arrow buttons
to change the value in predefined steps via mouseclick. Maximum and minimum
values are automatically controlled and obeyed, if set.
The returned events have the following structure:
ret = { mrwidget_numfield_evt, $
id : 0L, $ ; widget id of the mrwidget_numfield
top : 0L, $ ; top widget id
handler : 0L, $ ; handler widget id = mrwidget_numfield
type : 0, $ ; 0 for button event, 1 for manual change event
value : 0.0 $ ; current value of the field - boundary checked
}
mrwidget_numfield_realize
Description:
Draw the arrows upon realization.
mrwidget_numfield_arrowevt
Description:
mrwidget_numfield_evt
Description:
The main event handling routine. We only deal with events from
arrow presses (issued above) and from manual changes in the
text field.
Only release events from the arrows are passed on to the user
As for text events it depends on the /all_events settings.
If this is not set, the user needs to press return for a value to
take effect. Otherwise every change is recognized and handed to the
calling routine.
event type is '0' for button change events, 1 for text change events
mrwidget_numfield_set
Description:
Called from widget_control, this_id, set_value=value
Values that are out of the set boundaries are silently ignored.
mrwidget_numfield_get
Description:
Called via widget_control, this_id, get_value=value
state.value contains the last known good value, so we return that