-
Notifications
You must be signed in to change notification settings - Fork 580
Selectable
Vasiliy Edomin edited this page Aug 9, 2017
·
4 revisions
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);
/* 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);
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);
/* 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);