Re: Change the behaviour of a button



Am Montag, den 26.12.2005, 13:15 +0300 schrieb Yury Aliaev:
I'm sure there's a "right way" but if you're in a hurry you can do 
something I've used successfully. Use a table to lay out your objects, 
and pack two buttons into the same cell. Hide one. When you need to 
show the Stop button, hide the Remove button and show the Stop button. 
It works very well for me.


Thanks.
GtkTables are good.
I guess I should use gtk_widget_show() and gtk_widget_hide() to 
hide/unhide the buttons...

Naturally. You even can use GtkBox instead of GtkTable and pack all four 
widgets (two images and two labels) in it, and then pack this box into 
the button and show necessary and hide unnecessary widgets using 
gtk_widget_show()/gtk_widget_hide() functions.

I recommend against this since it will break the GUI for people who
disable images on buttons. You should rather pack both buttons into one
box (hbox or vbox), use the suggested show/hide code and use a
GtkSizeGroup which ensures that both always have the same size.

-- 
Christian Neumair <chris gnome-de org>


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