Skip to content
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

Dynamic height widget ? #196

Open
Temtaime opened this issue Oct 5, 2020 · 8 comments
Open

Dynamic height widget ? #196

Temtaime opened this issue Oct 5, 2020 · 8 comments

Comments

@Temtaime
Copy link

Temtaime commented Oct 5, 2020

Hello.
How can i create a widget that fills window by height ?
There's _dynamic layout functions, but they are only for width, not height.

@dumblob
Copy link
Member

dumblob commented Oct 5, 2020

The *_dynamic functions calculate width based on the content of these "containers" (not the surrounding of the container), i.e. unknown at the time the *_dynamic function is being called. It seems you're asking for a different thing - namely accommodating to the surrounding while assuming the surrounding information is already known at the time a function for fixed size is being called.

You're speaking of "window" - are you referring to Nuklear windows or operating system windows? The above paragraph assumes the latter in which case you can just read the size of the os window in each main event loop iteration. For the former case, just read nuklear.h (sorry, don't have time now and can't do it for you) - I'd guess some related information could be part of structs holding information about Nuklear windows.

@Temtaime
Copy link
Author

Temtaime commented Oct 6, 2020

Thanks for your reply.
I mean nk_window, not an OS one.
I want create a chat box with one input and nk_group of messages occupying all the free space.
There is nk_layout_row_dynamic but it makes the nk_group to occupy all the width but height is fixed.
I want a dynamic height for nk_group

@dumblob
Copy link
Member

dumblob commented Oct 6, 2020

For such a chat application I'd strongly recommend using a "container" widget (with vertical scrollbar) with a fixed number of items inside - see https://developers.google.com/web/updates/2016/07/infinite-scroller (the principle applies not just to web technologies).

@Temtaime
Copy link
Author

Temtaime commented Oct 6, 2020

I want to have nk_window resizeable so the user can configure number of chat rows.
I found that i can use nk_window_get_content_region to manually specify container's height.
Is this an only solution ?

@dumblob
Copy link
Member

dumblob commented Oct 6, 2020

I wouldn't say it's the only solution to your "chat" problem. IIRC there were people using Nuklear with very long vertical lists (tens of thousands of items) - so you might get an inspiration also there.

@wziard
Copy link

wziard commented Oct 8, 2020

Some more vertical layout options would be nice, though. Of course you can get the content region and position stuff manually, but the same can be said for horizontal layout and nuklear does do horizontal layout for you.

@dumblob
Copy link
Member

dumblob commented Oct 8, 2020

@wziard agreed. So far there was noone who would like to dive into the fierce depths of more general layouting (everything begins with vertical layouting...). PRs much welcome!

@wziard
Copy link

wziard commented Oct 9, 2020

fierce depths of more general layouting

:-D . Ok I think I'd aim for something a bit more simple at first. Just divvying up the vertical available space between the rows
should not be too complicated. I know from wxWidgets sizers and gtk box layouting that you can create nearly every gui you need by just nesting boxes...

I'll see if I understand the layouting code in Nuklear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants