Re: Setting exact size of Gtk::Label



Bruce and Cheryl said the following at 09/08/2011 05:14 PM :
> set_size_request(int, int);
> 

As I said:

> D. R. Evans wrote:
>> This is a trivial question... to which I am unable to find the answer :-(
>>
>> How do I set the precise size of a Label?
>>
>> The examples I found with Google use set_size_request(), but if I do that

So I am doing exactly what you suggest, but it definitely is not giving me
a precise size :-(

In this application the size of the container for the text has to be
precise and fixed, regardless of what text is later put into the container.
If there's too much text, then too bad -- presumably it'll get truncated;
but in any event the one thing that must not happen is the Label changing size.

I suppose I could inherit from Gtk::Label and reimplement set_text() so as
to test every write to the container to see if the new text will fit
(vertically and horizontally) and then truncate manually as necessary. That
really doesn't seem like something that the user should have to implement
-- it's hardly trivial -- but perhaps that's indeed what's expected.

  Doc

-- 
Web:  http://www.sff.net/people/N7DR

Attachment: signature.asc
Description: OpenPGP digital signature



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