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_size (...)
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.

  • Use popup_create to create a popup.
  • Use popup_add_elem to add an item to the list.
  • Capture multiple PopUp controls in a window.
    Figure 1: PopUps on Windows, macOS and Linux.

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);
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_size ()

Gets the number of items in the list.

uint32_t
popup_size(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 ❯