Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Selectable

Vasiliy Edomin edited this page Aug 9, 2017 · 4 revisions

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

Clone this wiki locally