Re: GTK+ Qt widget stack: how?



On Sun, 2004-10-10 at 18:53, Neil Zanella wrote:
> Hello,
> 
> I am migrating from Qt to GTK+ and from Qt designer to Glade.
> Hence, I would like to know the following as I cannot seem to
> find the answers in the GTK+ documentation:
> 
> --------------------------------------------------------------
> 
> 1. Qt Designer has the following widet, called a widget stack:
> 
>    $ designer
>      -> Window -> View -> Object Explorer
>      -> Containers -> Widget Stack
> 
>    which comes from the Qt class QWidgetStack. This basically allows
>    you to superimpose widgets in a container, with only one of them
>    being visible at a time. Then a selection such as the one from a
>    combo box emits a signal and the desisred widget from the widget
>    stack is plaed on the top of the stack with the other ones
>    becoming invisible as this takes place.
> 
>    Does GTK offer a similar widget? How about GNOME? I think
>    there should be such a widget somewhere. How do I use it
>    from within glade?

I don't think GTK has such a thing.  You could, however, place all the
objects in some sort of vbox, and then just hide each of the widgets you
don't want to see.  I would bet you could code up a little wrapper to
automate this, based on a signal handler or something.  I don't see how
this would really fit into glade, however. 

Also, making a new GTK class is not that hard (although not trivial) so
you could actually make a first class widget that acted in this way. 
Again, however, this would not have anything to do with Glade.

I'm not totally sure what you're trying to accomplish when you say "from
within Glade."  Glade is simply a tool to describe the gui in XML.  All
logic should be in the code that you write that interfaces with this
gui.

> 
> ---------------------------------------------------------------
> 
> 2. Glade 2.5.0 is telling me that the GTK+ Column Table (ctable)
>    widget is deprecated. However it seems to me that the new API
>    does not show it as being deprecated. What gives?

It is deprecated and I believe is listed as such in the header files. 
The correct widget is the new GtkTreeView widget.

> 
>    What else am I supposed to use if it relly is deprecated. Cause
>    I really do need a widget with columns that looks like a table,
>    and it seems to me that the glade "List or Tree View" isn't quite
>    capable of achieving the same effect (at least, in glade, it doesn't
>    seem to let me specify how many columns I want, which is not good).

That's because you don't specify this information in the GUI designer. 
In a MVC paradigm it is not correct to specify this information here
anyway.

Instead you programmatically create this.

First you create a new GtkTreeModel object that stores the data, then
you add renderers (a column at a time) to the GtkTreeView, referencing
the data model object.

A good tutorial on this is at http://scentric.net/tutorial/

Also, run the gtk-demo program and view the source code for the "Tree
View" demos.  I found these examples very enlightening.

GtkTreeView is a very powerful and intimidating widget.  Fortunately
there are some nice default renders that make normal columned lists
fairly easy to do.  On nice thing about GtkTreeView is that since it is
a Model-View-Controller design, you can have multiple views of the same
data.

> 
>    So is ctable deprecated or not, and if it is, what am I supposed
>    to do about it? I'm using GTK 2.4.7

Don't use ctable.  Use the GtkTreeView.  

> 
> ---------------------------------------------------------------------
> 
> Thanks for answering my newbie questions,
> 
> Best Regards,
> 
> Neil
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
-- 
Michael Torrie <torriem chem byu edu>



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