nuklear icon indicating copy to clipboard operation
nuklear copied to clipboard

nk_checkbox_label inside a loop and accessing it's values

Open LinArcX opened this issue 6 years ago • 3 comments

Hi. i need to generate nk_checkbox_label dynamically. So this is my code:

...
for(size_t  i=0; i<vector_size(projects); i++){
    if(nk_tree_push_id(ctx, NK_TREE_NODE, "Window", NK_MINIMIZED, i)) {
        nk_layout_row_dynamic(ctx, 25, 1);
        nk_label(ctx, "Files ready to commit:", NK_TEXT_LEFT);
        for (size_t  j = 0; j < vector_size(projects[i]); j++) {
            nk_checkbox_label(ctx, projects[i][j], &titlebar);
        }
        nk_tree_pop(ctx);
    }
}
...

How do that? And also how can i gather all checked lables in particular Node?

LinArcX avatar Aug 20 '19 13:08 LinArcX

I'm currently out of time, but did you look thoroughly through all the demos demo/ and examples example/?

dumblob avatar Aug 20 '19 14:08 dumblob

@dumblob Yeah, but they all created manually (No for loop, no dynamic creation).

LinArcX avatar Aug 20 '19 15:08 LinArcX

Ok. Do all the "manually created" checkboxes work for you? What does your current code actually do - what do you observe?

dumblob avatar Aug 20 '19 18:08 dumblob