PopUp
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.
Functions
PopUp* | popup_create (void) |
void | popup_OnSelect (...) |
void | popup_tooltip (...) |
void | popup_add_elem (...) |
void | popup_set_elem (...) |
void | popup_clear (...) |
uint32_t | popup_count (...) |
void | popup_list_height (...) |
void | popup_selected (...) |
uint32_t | popup_get_selected (...) |
const char_t* | popup_get_text (...) |
PopUps are buttons that have a drop-down menu associated with them (Figure 1). Apparently they look like pushbuttons that when pressed show a list of options. In Hello PopUp and Combo! you have an example of use.
- Use popup_create to create a popup.
- Use popup_add_elem to add an item to the list.
- Use popup_OnSelect to respond to the selection.
popup_create ()
Create a new popup control (PopUp button).
PopUp* popup_create(void);
Return
The newly popup.
popup_OnSelect ()
Set an event handler for the selection of a new item.
void popup_OnSelect(PopUp *popup, Listener *listener);
1 2 3 4 5 6 7 |
static void i_OnSelect(App *app, Event *e) { const EvButton *p = event_params(e, EvButton); do_something_onselect(app, p->index); } ... popup_OnSelect(popup, listener(app, i_OnSelect, App)); |
popup | The popup. |
listener | Callback function to be called after selecting a new item from the list. |
Remarks
See GUI Events.
popup_tooltip ()
Assign a tooltip to the popup control.
void popup_tooltip(PopUp *popup, const char_t *text);
popup | The popup. |
text | UTF8 C-string terminated in null character |
popup_add_elem ()
Add a new item to the popup list.
void popup_add_elem(PopUp *popup, const char_t *text, const Image *image);
popup | The popup. |
text | The text of the element in UTF-8 or the resource identifier. Resources. |
image | Icon associated with the resource element or identifier. For space, it will scale to a maximum maximum of 16 pixels. |
popup_set_elem ()
Edit an item from the drop-down list.
void popup_set_elem(PopUp *popup, const uint32_t index, const char_t *text, const Image *image);
popup | The popup. |
index | The index of the item to replace. |
text | The text of the element in UTF-8 or the resource identifier. Resources. |
image | Icon associated with the resource element or identifier. For space, it will scale to a maximum maximum of 16 pixels. |
popup_clear ()
Remove all items from the dropdown list.
void popup_clear(PopUp *popup);
popup | The popup. |
popup_count ()
Gets the number of items in the list.
uint32_t popup_count(const PopUp *popup);
popup | The popup. |
Return
The number of elements.
popup_list_height ()
Set the size of the drop-down list.
void popup_list_height(PopUp *popup, const uint32_t elems);
popup | The popup. |
elems | Number of visible elements. If the control has more, a scroll bar will appear. |
popup_selected ()
Set the selected popup element.
void popup_selected(PopUp *popup, const uint32_t index);
popup | The popup. |
index | The item to select. If we pass |
popup_get_selected ()
Get the selected popup item.
uint32_t popup_get_selected(const PopUp *popup);
popup | The popup. |
Return
The selected item.
popup_get_text ()
Gets the text of a popup element.
const char_t* popup_get_text(const PopUp *popup, const uint32_t index);
popup | The popup. |
index | The index of the element. |
Return
The text of the element.