Cross-platform C SDK logo

Cross-platform C SDK

PopUp

❮ Back
Next ❯
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)
voidpopup_OnSelect (...)
voidpopup_tooltip (...)
voidpopup_add_elem (...)
voidpopup_set_elem (...)
voidpopup_clear (...)
uint32_tpopup_count (...)
voidpopup_list_height (...)
voidpopup_selected (...)
uint32_tpopup_get_selected (...)

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.


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(UserData *data, Event *e)
{
    const EvButton *p = event_params(e, EvButton);
    do_something_onselect(data, p->index);
}
...
popup_OnSelect(popup, listener(data, i_OnSelect, UserData));
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 '\0'.


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 UINT32_MAX the selection is removed.


popup_get_selected ()

Get the selected popup item.

uint32_t
popup_get_selected(PopUp *popup);
popup

The popup.

Return

The selected item.

❮ Back
Next ❯