You are not logged in.
Pages: 1
The following is a question regarding the use of XfceArrowButton in C.
https://developer.xfce.org/xfce4-panel/ … utton.html says:
"Since 4.8 it is also possible to [...] pack additional widgets in the button, using gtk_container_add()."
Can anybody confirm that this actually works with more than one widget, e.g. an icon and a text label?
When I use gtk_container_add() two times only the first widget added gets displayed.
Is there any sample code I could refer to?
Offline
It derives from GtkBin, so you have to pack the label, icon, etc. in a GtkBox or similar, and add it to the button using gtk_container_add().
Xfce maintainer: https://gravatar.com/gaelbonithon
Offline
Thanks for your fast reply (which saved me even more hours of fruitless experiments); very much appreciated. So the sentence in the documentation can be a bit misleading for newbies since it uses plural...
Anyway, if one wants to display just either an icon or a label (and switch between those two states at runtime), is the best way then to simply use container_remove() on the currently added widget before adding the other one with container_add()?
Will container_remove() suffice, i.e. no need for hiding the to be removed widget first?
Also, am I right to assume that container_remove() does not affect the widget's data structures and it can be directly resumed being used again at any later point?
https://docs.gtk.org/gtk3/method.Container.remove.html seems to indicate differently. So is destroying the widget and at some later point, if it is to be used again, completely recreating it, the better choice?
Offline
No need to hide a widget before removing or destroying it, however, as the gtk doc says, if you want it not to be destroyed when removing it, you have to keep a reference on it first using g_object_ref() (and then g_object_unref() it when it's added to a container again).
Xfce maintainer: https://gravatar.com/gaelbonithon
Offline
Pages: 1
[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 539.91 KiB (Peak: 540.76 KiB) ]