Next: , Previous: , Up: Select Object   [Contents][Index]


19.1.4 Select Attributes

The two color arguments, clo1 and col2, of the function fl_set_object_color() set the background color of the object normally and when the mouse is hovering over it, respectively.

With the functions

FL_COLOR fl_set_selection_text_color(FL_OBJECT *obj, FL_COLOR color);
FL_COLOR fl_get_selection_text_color(FL_OBJECT *obj);

the color of the text of the currently selected item on top of the object can be set or queried.

To control (or determine) the alignment of the text with the currently selected item on top of the select object use

int fl_set_select_text_align(FLOBJECT *obj, int align);
int fl_get_select_text_align(FLOBJECT *obj);

Please note that the FL_ALIGN_INSIDE flag should be set with align since the text always will be drawn within the boundaries of the object. On success the function return the old setting for the alignment or -1 on error.

Finally, the font style and size of the text can be set or obtained using

int fl_set_select_text_font(FL_OBJECT *obj, int style, int size);
int fl_get_select_text_font(FL_OBJECT *obj, int *style, int *size);

The rest of the appearance of a select object concerns the popup that is used. To avoid bloating the API unnecessarily no functions for select objects were added that would just call popup functions. The popup belonging to a select object can be easily found from either a FL_POPUP_ENTRY structure as returned by the functions for searching for items or the FL_POPUP_RETURN structure passed to all callbacks and also returned by fl_get_select_item(). Both structures have a member called popup that is a pointer to the popup associated with the select object. For popup functions operation on indiviual items just use the pointer to the FL_POPUP_ENTRY structure itself or the entry member of the FL_POPUP_RETURN structure.

There’s also a convenience function for finding out the popup used for a select object:

FL_POPUP *fl_get_select_popup(FL_OBJECT *obj);

During the lifetime of a select object the popup never changes as long as fl_set_select_popup() isn’t called.

Per default the popup of a select object does not have a title drawn on top of it. To change that use fl_popup_set_title().

To change the various colors and fonts used when drawing the popup use the functions fl_popup_set_color() and fl_popup_entry_set_font() (and fl_popup_set_title_font()).

To change the border width or minimum width of the popup use fl_popup_set_bw() and fl_popup_set_min_width().

To disable or hide (or do the reverse) an item use the functions fl_popup_entry_set_state() and fl_popup_entry_get_state().

The keyboard shortcut for an entry can be set via fl_popup_entry_set_shortcut().

The callback functions (selection, enter and leave callback) for individual items can be set via fl_popup_entry_set_callback(), fl_popup_entry_set_enter_callback() and fl_popup_entry_set_leave_callback(), a callback for the whole popup with fl_popup_set_callback().

Finally, to assign a different (long) value to an item or set a pointer to user data use fl_popup_entry_set_value() and fl_popup_entry_set_user_data().


Next: , Previous: , Up: Select Object   [Contents][Index]