Re: [gtk-list] how to swap pixmaps in a button?



On Wed, 21 Jan 1998, Michael J. Hammel wrote:

> I've been trying to get a button to swap pixmaps when its been activated.
> I have two pixmaps and do something like the following:
> 
>    gtk_container_remove(
>       GTK_CONTAINER(pn->pn_alarmwidget), pn->pn_alarm_pixmapid);
>    gtk_container_add(
>       GTK_CONTAINER(pn->pn_alarmwidget), pn->pn_alarmoff_pixmapid);
> 
> I remove the old one then add the new one.  But this doesn't seem to have
> any effect.  Does anyone know what the steps are for swapping pixmaps in a
> button (or any widget)?  Do I need to be doing this from the gdk level
> instead?

hm, the most simple way is probably to add a vbox to the
button and add the pixmaps to the vbox.
then do

gtk_container_block_resize (GTK_CONTAINER (pixmap->parent));
gtk_widget_hide (pixmap);
gtk_widget_show (other_pixmap);
gtk_container_unblock_resize (GTK_CONTAINER (pixmap->parent));

i did that in the old version of gemvt and am still doing
it in the status bar, it works perfectly.


> Michael J. Hammel           |

---
ciaoTJ



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