Re: Setting exact size of Gtk::Label

Ian Martin said the following at 09/08/2011 06:52 PM :

> You seem to want a Label that may or may not display enough text to be 
> legible, which Gtk::Fixed will do for you.  If the amount of text is 

Thank you -- that's exactly what I want, so I'm very glad to hear it
confirmed that this can be done. I was beginning to wonder if it was even
possible given Harry's comment that gtkmm "is designed to expand widgets to
show the contents".

> variable, then it's probably wise to put it in a scrolling widget( a 

I want something much simpler... just a place to write text. No scroll
bars, no changing-size automatically to fit the text, nothing. Really, I'm
looking for something's that's pretty much the simplest possible conceptual
widget. I don't know why I'm finding it so hard. The Label widget seemed
perfect: I wasn't expecting it to change size on me (and I don't see
anything in the documentation to suggest that that's what happens -- indeed
the functions related to ellipses explicitly talk about cases where not all
the text fits).

I probably should have framed a simple problem statement for the reflector;
something like this:

I need to delineate a rectangle on the screen, of a precisely given
position and size, and write text within that rectangle, with a guarantee
that the text, no matter what its length, will never extend outside the

It seems easy; but apparently it is not :-(

> bog-standard TextView inside a ScrolledWindow would work nicely- as in 
> the book 
> <>).  

So it sounds like you're suggesting a TextView instead of a Label. (Are
you? -- I'm a bit puzzled because the first sentence of your reply seems to
suggest that a Label can do this, but I sure haven't been able to get it
remain fixed in size.)

It's getting late here, so I'll look at the capabilities of a TextView
tomorrow when I'm fresh. I think I had briefly looked at it before, but I
got the impression that it wasn't really just for displaying simple text;
it seemed something much more complex than what I need.

> That way when the widget is too small to make out the words, you'll 
> still be able to scroll around.  Have a look in the manual for a working 
> example.
> If you want to capture events, you've got at least 2 options.  You can 
> put an EventBox underneath the widget of interest- a textview or a 

Yes; I sussed the EventBox trick from googling. I think I understand how
that works.

But then I thought I understood Labels until I actually tried to use one
and discovered that its size wasn't necessarily what was requested :-) I
guess that's why it's called a "request".



Attachment: signature.asc
Description: OpenPGP digital signature

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