Nuklear icon indicating copy to clipboard operation
Nuklear copied to clipboard

Add to ComboBox "DropUp" if no space available to DropDown.

Open neonr-0 opened this issue 5 years ago • 8 comments

Add ComboBox "DropUp" if no space available in layout height. #110

neonr-0 avatar Apr 14 '20 14:04 neonr-0

Thanks for the prompt response. Before we'll dive into this, could you please check how PRs are getting reviewed?

dumblob avatar Apr 14 '20 16:04 dumblob

Hmm. I'm not sure if this is quite the right approach. I guess that depends on the wanted behavior. Currently, the dropdown is allowed to go out of the window, and this isn't really a problem unless it actually escapes the programs window. out

I'd say the best approach might be to break the combo box api to allow specifying whether the thing drops down or up. Maybe something like this:

enum nk_drop_direction {
    NK_DROP_UP,
    NK_DROP_DOWN,
    NK_DROP_AUTO = NK_DROP_AUTO_PREFER_DOWN,

    /* Drops down, unless there isn't room in the window, in which case it drops up */
    NK_DROP_AUTO_PREFER_DOWN,
    /* Drops up, unless there isn't room in the window, in which case it drops down */
    NK_DROP_AUTO_PREFER_UP,
}

Hejsil avatar Apr 14 '20 16:04 Hejsil

It not break if we set before call nk_combo_begin As example nk_combo_set_direction(NK_DROP_AUTO_PREFER_UP) But it will create more complexity...

Thanks for the prompt response. Before we'll dive into this, could you please check how PRs are getting reviewed?

yep commentary in code excessless...

neonr-0 avatar Apr 14 '20 16:04 neonr-0

It not break if we set before call nk_combo_begin As example nk_combo_set_direction(NK_DROP_AUTO_PREFER_UP) But it will create more complexity...

Hmm, yea that could work. I do think passing it in directly is a better API choice, and we're are not afraid of doing breaking changes as long as it is versioned appropriately. I'll leave it up to you whether you want to break API or not. I think both approaches are fine.

Hejsil avatar Apr 14 '20 16:04 Hejsil

If we Break API need more changes for some reason, not just add ComboBox to display mode.... But I think change API also better.

neonr-0 avatar Apr 14 '20 17:04 neonr-0

Something like this. output.

neonr-0 avatar Apr 16 '20 13:04 neonr-0

Very cool. I'll see if I can take a look at this code over the weekend. I'll assume this new API is good unless someone else complains :)

Hejsil avatar Apr 16 '20 21:04 Hejsil

Found something doing wrong in my code... If we pass to combobox bigger height it clip in "ctx->popup" layout. On drop down works fine because it's clip it by height (start point at y is correct) but on drop up start point at y based input height. I need figure out and understand how to move start y position on all combobox "popup-ed" layouts based on clipping height... tmp2 Of course we can precalculate height based on elements in combo-box, but this it not solution. Well need some more time then I expected :( But in my setup it work... but it need to work not only in my setup :)

neonr-0 avatar Apr 19 '20 00:04 neonr-0