Re: howto exchange one widget with another widget



Caspar Bothmer wrote:

I want to show a frame/button/whatsoever in one window and on user
interaction I want to exchange it against another one of the same size.


Two things spring to mind: you could create a dummy holder (not visible) for the alternate widget. Then have the widget to be replaced inside a single Box container. Then use the widget reparent call to put the old one inside the hidden holder, and then the new one inside the empty Box.

I have a nasty feeling that when you do this, though, empty parents get automatically deleted, so you could have a bit of a fight on your hands ...


The other (easier!) thing I thought of was simply this: put a small GtkNotebook where you want the widget(s) to be. Then, place each of your alternate widgets into a separate page in this notebook - only one will be visible at any one time.

All you need do is set the 'tabs' visibility to 'off' (there's a notebook call to do that before showing it), so the fact that there's a notebook there is transparent (if you're using glade, manage the design etc. with tabs on to make it easier, then just turn 'em off before saving).

The notebook size will reflect the max. size of any of the widgets/pages. You can then select the correct visible page number (from your code) at will.

--
[neil fnx ~]# rm -f .signature
[neil fnx ~]# ls -l .signature
ls: .signature: No such file or directory
[neil fnx ~]# exit




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