Re: more size questions



Chris Vine said the following at 09/09/2011 06:33 AM :

> This assumes of course that the even simpler approach of putting a
> Gtk::Label into a Gtk::Fixed as the Gtk::Fixed's one and only child
> doesn't do what you want, so you need to customise it further.

That would be perfect... except that override_background_color() doesn't
work on Labels. So I have to have some other widget in addition to the
Label. I have been using an EventBox and then adding the Label to the
EventBox, because that's what I found by googling the question of how to
set the background colour for a Label.

So we have a Label inside an EventBox inside a Fixed... which all along has
seemed like it should work -- after all, the documentation for Fixed
explicitly says that:

"The Gtk::Fixed widget is a container which can place child widgets at
fixed positions and with fixed sizes, given in pixels."

But having a Label inside an EventBox inside the Fixed doesn't work: the
Label changes size, and hence so does the EventBox.

There are functions with suggestive names line set_vexpand(bool) and
set_hexpand(bool) whose purpose is undocumented but sound like they could
be used to fix the size of a widget. But they don't. I don't know what they
do, but the widgets still change size even after these functions have been
called.

The solutions using Cairo might be possible; I'll have to look at it -- I
don't know anything about Cairo. I do have the horrible feeling that I'm
diving ever deeper into a mire simply to implement something that is
trivial on 1980s-era PCs. It seems like colouring a rectangle and putting
text in the coloured area shouldn't be that hard.

  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]