Re: Dumb question
- From: Mark Leisher <mleisher crl nmsu edu>
- To: Chris Moller <cmoller redhat com>
- Cc: gtk-list gnome org
- Subject: Re: Dumb question
- Date: Tue, 07 Mar 2006 09:39:21 -0700
Chris Moller wrote:
I'm writing a roll-your-own widget that uses, among other things, a few
buttons (via gtk_button_new()) and spin_buttons
(gtk_spin_button_new()). In my widget _init() fcn, I create all the
buttons, pack them into an hbox, and pack the hbox and some other stuff
into a vbox. When the app the uses the new widget runs, the spin
buttons show up but the regular buttons don't. They're there--if you
click on the empty space where they ought to be, the callback gets
invoked, but the buttons aren't visible. This happens regardless of
whether I use gtk_button_new_with_label ("whatever"), or just
gtk_button_new() and gtk_container_add() various things (labels, labels
in boxes, etc) to the button later.
Anyone have a clue what's happening?
Not so dumb. I struggled with this one for a couple months.
I discovered with GTK+ 2.7 and later that when creating subclasses of
GtkContainer, you *have* to implement the add, remove, and forall class
functions of the GtkContainerClass.
The add and remove functions don't need to do anything, but the forall
function should apply the passed callback to all the children you've
created.
Without all three functions implemented, some of the child widgets show
up and some don't.
--
---------------------------------------------------------------------------
Mark Leisher
Computing Research Lab In the republic of mediocrity,
New Mexico State University genius is dangerous.
Box 30001, MSC 3CRL -- Robert G. Ingersoll
(1833-1899)
Las Cruces, NM 88003
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]