Re: A Scrollable Box Widget

I think I haven't explained what I want to do quite well enough. What I am
trying to do is make a nice message display widget for Balsa. A message is
displayed in several sections:

The headers, a GtkText,
The content of the selected part, might be a GtkText or a GtkPixmap -
eventually even a GtkHTML etc.
The MIME parts list, a gnome icon list.

I want to have all three of these scroll together, using a single scrollbar.
With a standard gtkbox this doesn't work, since the GtkText's request their
smallest size, and get allocated that size, but don't scroll.

Dan Winship has suggested using the size_request callback to override the
requisition, which is almost what I was already doing (well, I made a stupid
container to override the size_request, I now realize this isn't necessary,
since I can jst implement the signal).

The problem is that the GtkText must now be allocated the size of the entire
text it holds, rather than as big as the window it is displaying in.

This can cause problems when the text of a message is very long. I have seen
occasions where the size requisition has wrapped, which causes the size
requested to be too small, and everything to go horribly wrong.

So, thats why I wanted a ScrollableBox, which is both aware of children which
are scrollable and is scrollable itself.

I started ripping code from GtkViewport and GtkBox to do it, but I was hoping
someone had beaten me too it. 

Anyway, thanks to everyone for the help/suggestions. Unless anyone knows of a
widget which helps I shall continue to try and make a ScrollableBox widget..

Thanks again,

On Thu, 27 Apr 2000 12:14:43 Havoc Pennington wrote:
> Ian Campbell <> writes:
> > I have, if the box contains a GtkText then this is just allocated a
> > fixed size and doesn't scroll.
> > 
> You mean the GtkText has no scrollbar? That doesn't make any sense,
> its size request isn't supposed to be related to the amount of text it
> contains. Hmm. Not sure what's happening there...
> Havoc

Ian Campbell
Churchill College, Cambridge.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]