Re: Need widget to edit label text



On Wed, Dec 04, 2002 at 02:13:10PM -0800, The Surprises wrote: 
> I've started to code one up, but am running into issues.  I have an
> hbox, with a label on top, and a set of buttons beneath.  The label is
> wrapped into an EventBox so I can grab button press.  Within my button
> press handler, I get the eventbox's parent (which is the toplevel hbox),
> then I destroy the event box, create a GtkEntry widget, and pack the
> entry widget into the parent hbox.  This works, but the only problem is
> that the entry box shows up below the set of buttons in my hbox instead
> of where the label previously was.  I tried both
> gtk_box_pack_(start|end) with same results.  Is there any way I can pack
> at the top of the hbox?

You mean vbox I'm assuming, though it doesn't really matter.

Three approaches: 
 1) pack_end() the buttons so they are always at the end
    (pack_start/pack_end doesn't make a difference if you 
     pack_start the buttons)
 2) use gtk_box_reorder_child() to move your newly-added
    item to the first position.
 3) don't destroy the eventbox, just destroy the label. 
    then pack the entry in the event box.

Havoc



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