Navigation C API Pages Python bindings Applications

Choice widget

A choice widget is a class of widgets that allows to select exactly one choice from a given set.

The widget class allows to get values and modify widget state by an unified API.

Choice class API functions
void gp_widget_choice_set(gp_widget *self, unsigned int sel);

unsigned int gp_widget_choice_get(gp_widget *self);

Spinbutton

gp_widget *gp_widget_spinbutton_new(const char *choices[],
                                    unsigned int choice_cnt,
                                    unsigned int selected,
                                    int (*on_event)(gp_widget_event *self),
                                    void *priv)

Spinbutton is parsed from JSON with when type equals to "spinbutton".

Spinbutton

Spinbutton

Radiobutton

gp_widget *gp_widget_radiobutton_new(const char *choices[],
                                     unsigned int choice_cnt,
                                     unsigned int selected,
                                     int (*on_event)(gp_widget_event *self),
                                     void *priv)

Radiobutton is parsed from JSON with when type equals to "radiobutton".

Radiobutton

Radiobutton

Table 1. Choice class JSON attributes
Attribute Type Default Description

choices

string array

List of choices

selected

uint

0

Currently selected choice

Table 2. Choice class widget events
Widget event value Description

0

Emitted on selection change.