Next: Other Button Routines, Previous: Button Types, Up: Part III Button-like Objects [Contents][Index]
FL_NORMAL_BUTTON
s, FL_PUSH_BUTTON
s,
FL_RADIO_BUTTON
s, FL_RETURN_BUTTON
s and
FL_HIDDEN_BUTTON
s are returned at the moment the user
releases the mouse after having pressed it on the button. A
FL_MENU_BUTTON
, in contrast, is returned already on a
mouse press. A FL_INOUT_BUTTON
is returned both when the
user presses it and when the user releases it. A
FL_TOUCH_BUTTON
is returned all the time as long as the
user keeps the mouse button pressed while the mouse is on top of it. A
FL_RETURN_BUTTON
and a FL_HIDDEN_RET_BUTTON
are also returned when the user presses the <Return>
key.
As for other “active” objects, you can control under which conditions a button object gets returned or its callback invoked by using the function
int fl_set_object_return(FL_OBJECT *obj, unsigned int when);
where reasonable values for when
are
FL_RETURN_NONE
Never return object or invoke callback.
FL_RETURN_END_CHANGED
Return object or invoke callback when mouse button is released and at the same moment the state of the button changed.
FL_RETURN_CHANGED
Return object or invoke callback whenever the state of the button changes.
FL_RETURN_END
Return object or invoke callback when mouse button is released
FL_RETURN_ALWAYS
Return object or invoke callback on all of the above condtions.
Most buttons will always return FL_RETURN_END
and
FL_RETURN_CHANGED
at the same time. Exceptions are
FL_INOUT_BUTTON
s and FL_TOUCH_BUTTON
s. The
former returns FL_RETURN_CHANGED
when pushed and both
FL_RETURN_END
and FL_RETURN_CHANGED
together
when released. FL_TOUCH_BUTTON
s return when pressed, then
FL_RETURN_CHANGED
at regular time intervals while being
pressed and finally FL_RETURN_END
when released.
See demo butttypes.c for a feel of the different button types.
Next: Other Button Routines, Previous: Button Types, Up: Part III Button-like Objects [Contents][Index]