Re: [gtkmm] Q: how to centre in a VBox?
- From: "D. R. Evans" <N7DR arrisi com>
- Cc: gtkmm-list gnome org
- Subject: Re: [gtkmm] Q: how to centre in a VBox?
- Date: Thu, 23 Oct 2003 08:57:49 -0600
Martin Schulze wrote:
Am 2003.10.22 18:01 schrieb(en) D. R. Evans:
I'm sure this is utterly trivial... but after several hours of trying,
I'm giving up and asking for help.
I have several HBoxes, which I would like to pack into a VBox that is
displayed as a page in a Notebook.
How do I pack things so that when the Notebook page displays, the
HBoxes are vertically centred (either exactly or to a reasonable
approximation) on the page? So that the page looks like:
-------------------------------
| |
| |
| hbox here |
| hbox here |
| hbox here |
| |
| |
-------------------------------
You could use a hbox and add e.g. an empty label before and
after the widgets that should be shown centered with expand=true.
Yes, that's what I thought, too. But it doesn't actually work. I created a
label with no contents and I got runtime errors...
... goes away for a few minutes and plays some more...
Ah! gtkmm seems to violate normal STL semantics regarding lifetimes. If I
use an hbox that goes out of scope at the end of the page's constructor,
then it doesn't work -- I have to include the hbox as an object carried
inside the class that defines the page. Oddly, though, the same is not true
for the label that goes inside the hbox -- that can go out of scope at the
end of the constructor with no ill effects. Strange.
Anyway, I got it to work. Thanks very much. (I did actually try this idea
out before posting, but since I was getting errors I figured that the basic
idea must be wrong somehow, but your posting encouraged me that the basic
idea was correct, but it was just the execution that was somehow flawed.)
Doc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]