-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple window instances #640
Comments
Possible solution is to make a function for the "template", and call it after defining each window void mytemplate(ctx) {
/* fixed widget pixel width */
nk_layout_row_static(ctx, 30, 80, 1);
if (nk_button_label(ctx, "button")) {
/* event handling */
}
}
// ....
struct nk_context ctx;
if (nk_begin(&ctx, "Window 1", nk_rect(50, 50, 220, 220),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
mytemplate(ctx);
}
nk_end(&ctx);
if (nk_begin(&ctx, "Window 2", nk_rect(50, 50, 220, 220),
NK_WINDOW_BORDER|NK_WINDOW_MOVABLE|NK_WINDOW_CLOSABLE)) {
mytemplate(ctx);
}
nk_end(&ctx); |
Thank you. I suppose I've had in my head that the string id's would have to be compile-time defined. If that's reasonable, then this approach is definitely fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to have multiple windows, each with the same "template" so-to-speak, but with varying content?
With what I know of the code base so far, I don't think this can be done.
Each window has a hard-coded string identifier, which I believe is used predominantly to store and reference it's scroll position(s).
I don't see a way around this.
Is there perhaps an alternative to help effectively achieve the same ends?
The text was updated successfully, but these errors were encountered: