Automatic vertical size for scrollable dialog?

14 views
Skip to first unread message

Brent Yorgey

unread,
Jul 26, 2022, 9:39:55 AM7/26/22
to Brick Users
Hi all,

I'd like to make a scrollable dialog that expands vertically to fit the body widget.  That is,

- If the body widget is not very tall, the dialog's vertical size should be only just large enough to fit the body widget.
- If the body widget is taller than the available vertical space for the dialog, then the content of the dialog can be scrolled up and down.

However, I am not sure how to accomplish this.  If I just make a dialog with no viewport, its vertical size correctly fits the body widget.  But of course when the body widget is too tall it gets cut off and cannot be scrolled.  However, when I wrap the body widget in a viewport, the dialog immediately expands to fill all available vertical space, no matter how tall (or not) the body widget is.

Any ideas?  Thanks!

-Brent

Jonathan Daugherty

unread,
Jul 26, 2022, 1:42:59 PM7/26/22
to Brent Yorgey, Brick Users
Hi Brent,

This is possible but will probably be tricky to get exactly right and it
may require making some simplifying assumptions. I put together a demo
program that shows a way that this could work (with some rough edges
that we can discuss).

Clone the 'demo/dynamic-viewport-byorgey' branch of Brick and run
the 'brick-brent-demo' program to check it out. See the source in
'programs/BrentDemo.hs' for how to use it. I can provide an in-depth
explanation later (a ticket might be best, so we can also play around
with Haskell source there) but for now, you can try this demo and see
how much closer it gets to what you want. If it looks promising, then we
can get into the details.

https://github.com/jtdaugherty/brick/tree/demo/dynamic-viewport-byorgey
> --
> You received this message because you are subscribed to the Google Groups "Brick Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to brick-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/brick-users/22528f39-ab4b-4fb1-926e-dbe680fb4a82n%40googlegroups.com.


--
Jonathan Daugherty
Reply all
Reply to author
Forward
0 new messages