Selectable - vurtun/nuklear GitHub Wiki
Selectable label
static int selected = nk_true; /* outside main cycle */
...
/* within main cycle */
if (nk_begin(ctx, "Test", nk_rect(32, 32, 192, 192), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE))
{
nk_layout_row_dynamic(ctx, 30, 1);
nk_selectable_label(ctx, "label_1", NK_TEXT_LEFT, &selected);
}
nk_end(ctx);
Selectable text
/* outside main cycle */
static int selected = nk_true;
static const char text[] = "text";
...
/* within main cycle */
if (nk_begin(ctx, "Test", nk_rect(32, 32, 192, 192), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE))
{
nk_layout_row_dynamic(ctx, 30, 1);
nk_selectable_text(ctx, text, strlen(text), NK_TEXT_LEFT, &selected);
}
nk_end(ctx);
Select label
static int selected = nk_true; /* outside main cycle */
...
/* within main cycle */
if (nk_begin(ctx, "Test", nk_rect(32, 32, 192, 192), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE))
{
nk_layout_row_dynamic(ctx, 30, 1);
selected = nk_select_label(ctx, "label_2", NK_TEXT_LEFT, selected);
}
nk_end(ctx);
Select text
/* outside main cycle */
static int selected = nk_true;
static const char text[] = "text_2";
...
/* within main cycle */
if (nk_begin(ctx, "Test", nk_rect(32, 32, 192, 192), NK_WINDOW_BORDER | NK_WINDOW_MOVABLE | NK_WINDOW_CLOSABLE))
{
nk_layout_row_dynamic(ctx, 30, 1);
selected = nk_select_text(ctx, text, strlen(text), NK_TEXT_LEFT, selected);
}
nk_end(ctx);