Automatic vertical size for scrollable dialog?

Skip to first unread message

Brent Yorgey

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!


Jonathan Daugherty

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.
> --
> 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
> To view this discussion on the web visit

Jonathan Daugherty
Reply all
Reply to author
0 new messages