[Glade-users] is there an example or tutorial about the use of 'GtkTreeStore' in the Glade?
Tristan Van Berkom
tristan.van.berkom at gmail.com
Fri Apr 1 18:09:06 EDT 2011
On Sat, Apr 2, 2011 at 5:58 AM, Cleber N. Borges <klebyn at yahoo.com.br> wrote:
> Em 1/4/2011 15:53, Tristan Van Berkom escreveu:
>> On Sat, Apr 2, 2011 at 3:49 AM, Tristan Van Berkom<tvb at gnome.org> wrote:
>>> On Sat, Apr 2, 2011 at 2:36 AM, Cleber N. Borges<klebyn at yahoo.com.br> wrote:
>>>> Em 1/4/2011 13:20, John Delaney escreveu:
>>>>> On Fri, Apr 1, 2011 at 5:11 PM, Cleber N. Borges<klebyn at yahoo.com.br> wrote:
>>>>>> in first place, I create an GtkTreeStore object in glade, and after, I
>>>>>> create
>>>>>> an GtkTreeView...
>>>>>> in menu edit of GtkTreeView, I make the option to use the GtkTreeStore
>>>>>> model...
>>>>>>
>>>>>> but, in runtime testing I don't obtain the Tree model in the window
>>>>>> display...
>>>>> Have you defined cell renderers for the tree view columns? Select the
>>>>> tree view and click on Edit to access the Tree View Editor, go to the
>>>>> "Hierarchy" tab to add/remove tree view columns, then right click a
>>>>> column to add the appropriate child cell renderer(s). Then you'd need
>>>>> to edit the relevant properties of each cell renderer, e.g. tell it to
>>>>> get the 'text' property from column 3 of the model for a text
>>>>> cellrenderer.
>>>>>
>>>> sorry because I was concisely so much...
>>>> and I don't describe the part of de childrens models...
>>>> But,
>>>> I create the cellrenderes, 3 GtkCellRendererText...
>>>> but it not appear in the Glade window in the development phase...
>>>> below, follows my glade file for example...
>>>>
>>>> Thanks
>>> A.) GtkBuilder does not allow adding<rows> (data) to GtkTreeStore
>>>
>>> B.) A GtkTreeStore using a GtkTreeView with a GtkTreeStore no data
>>> will display all the rows in the empy GtkTreeStore properly
>> Err, big hurry this morning, that was supposed to read:
>>
>> B.) A GtkTreeView with a GtkTreeStore with no data will display all the rows
>> in the empty GtkTreeStore properly.
>>
>> > i.e., it will properly display "nothing".
>> >
>> > So you should not expect to see anything in Glade, you can test your
>> > view by using a GtkListStore and adding some data to it, or you can
>> > run your program that loads the builder file and add some data to the
>> > treestore and see how it looks.
>> >
>> > Cheers,
>> > -Tristan
>>
>
>
> B.) Ok. I guess that I understand...
>
> in my case, the command make to appear in the main window (in scroll)
> -----
>
> treeview <- gtkBuilderGetObject( GUI, 'treeview_models' )
> class( treeview )
>
> model <- gtkTreeViewGetModel( treeview )
> class( model )
>
> gtkTreeStoreInsert( model, position=1 )
>
>
> ---
> make more gain in this mail, I make an more question
> in summary, I would like an VISUAL structure like below.
>
> How get this?
>
> chem_models
> |
> |---pca_models ( VISIBLE by now )
> | |
> | |--- pca-1 (in future) insert elemnts in runtime
> | |--- pca-2 (in future) insert elemnts in runtime
> | |--- pca-n (in future) insert elemnts in runtime
> |
> |---hca_models ( VISIBLE by now)
> | |
> | |--- hca-1 (in future) insert elemnts in runtime
> | |--- hca-2 (in future) insert elemnts in runtime
> |
> |---pls_models ( VISIBLE by now)
> | |
> | |--- (in future) insert elemnts in runtime
> |
>
I dont know if I understand what you are asking.
What could you possibly mean by "VISIBLE by now" ??
Let me be clear.
If you need to use a GtkTreeStore, you can define the column types
in Glade... you CANNOT add any data to it.
ANYTHING you add to the GtkTreeStore must be done with code.
>
> so, I my glade file I get the follow widget definitions:
> ( my run code in R )
>
>
>
>
> >
> > treeview <- gtkBuilderGetObject( GUI, 'treeview_models' )
> > class( treeview )
> [1] "GtkTreeView" "GtkContainer" "GtkWidget"
> [4] "GtkObject" "GInitiallyUnowned" "GObject"
> [7] "RGtkObject"
> >
> > model <- gtkTreeViewGetModel( treeview )
> > class( model )
> [1] "GtkTreeStore" "GObject" "RGtkObject"
> > gtkTreeStoreInsert( model, position=1 )
> $retval
> NULL
>
> $iter
> <pointer: 0x03802410>
> attr(,"interfaces")
> character(0)
> attr(,"class")
> [1] "GtkTreeIter" "GBoxed" "RGtkObject"
>
> >
> > colunas <- gtkTreeViewGetColumn( treeview, n=0 )
> > class( colunas )
> [1] "GtkTreeViewColumn" "GtkObject" "GInitiallyUnowned"
> [4] "GObject" "RGtkObject"
> > gtkTreeViewColumnGetTitle( colunas )
> [1] "Chemometrics Models"
> > # ?GtkTreeViewColumn
> >
> > sub_colunas <- gtkTreeViewColumnGetCellRenderers( colunas )
> > class( sub_colunas )
> [1] "list"
> > # ?GtkCellRenderer
> > length( sub_colunas )
> [1] 3
> >
> > class( sub_colunas[[1]] ) # shoud be: pca_models
> [1] "GtkCellRendererText" "GtkCellRenderer" "GtkObject"
> [4] "GInitiallyUnowned" "GObject" "RGtkObject"
> > class( sub_colunas[[2]] ) # shoud be: hca_models
> [1] "GtkCellRendererText" "GtkCellRenderer" "GtkObject"
> [4] "GInitiallyUnowned" "GObject" "RGtkObject"
> > class( sub_colunas[[3]] ) # shoud be: pls_models
> [1] "GtkCellRendererText" "GtkCellRenderer" "GtkObject"
> [4] "GInitiallyUnowned" "GObject" "RGtkObject"
> >
> >
This is all greek to me, I have no idea what any of this means.
Regards,
-Tristan
More information about the Glade-users
mailing list