Reputation: 461
I would like to limit the growth of a GTK text view (controlled by the program, not user) to only the size of its container. When the window resizes, I want it to resize, otherwise I want it to fit where it belongs. It tries to expand horizontally indefinitely instead of wrapping at its current width.
Upvotes: 2
Views: 2055
Reputation: 14436
Indeed, you can put your widget into a ScrolledWindow, but beware: this will help only if POLICY is set to POLICY_AUTOMATIC
or POLICY_ALWAYS
- then ScrolledWindow will request only a minimal amount of space, required to draw its scrollbars.
If POLICY is POLICY_NEVER
, ScrolledWindow will request as much size as it child requests, and the toplevel window will grow beyond its normal size. See gtkscrolledwindow.c
, comment in the very beginning.
Upvotes: 1