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

Re: GtkTreeView



Murray.Cumming@Comneon.com wrote:
 >>1) Put a vertical scroll bar in a GtkTreeView widget.  Surely a
 >>GtkScrolledWindow would also scroll the column headings, which is not
 >>what I want.
 >
 > Have you tried it? It does what you want. I don't think a 
GtkScrolledWindow
 > is quite as simple as you imagine. I think there are hooks for 
appropriate
 > behaviour.

This worked as you expected (not as I expected!)  Thanks :-)

 >
 >>2) Allow a user to toggle a GtkCellRendererToggle.  This
 >>should update
 >>an underlying G_TYPE_BOOLEAN field in the GtkTreeStore.
 >>
 >>Unfortunately I have got stuck on both of these.  Any help would be
 >>appreciated,
 >
 >
 > You need to set the CellRenderer's "activatable" property to TRUE, 
and you
 > need to handle it's toggled signal to set the new value back into the 
model.

I managed to do that, but encountered some strangeness.  The callback 
only happened when the value of the field was "1".  Initializing the 
field to 0 leaves the check slightly greyed and unable to respond to a 
"toggle".  e.g.

gtk_tree_store_set(tree_store, &k, col_text, q->words[w], col_type, 
plain_word, col_senseid, 0, col_select, 0, -1);

Also I was wondering whether the type of this column should be 
G_TYPE_BOOLEAN or G_TYPE_INT.  I only need booleans, changing this does 
not seem to affect things.

 > It's easier with gtkmm, which does this common-case stuff automatically:
 > http://www.gtkmm.org/gtkmm2/docs/tutorial/html/ch08s02.html#id2878262

I agree that gtkmm would be much easier, but the rest of the code is in 
plain GTK so I'll have to stick with it.  OO via C is unnecessarily 
laborious!

Calum Grant






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