Re: Editable toggle when multiple model cols in view col



Hi again Murray,

Sorry to be such a nuisance... :)
Thanks for your help so far.

Murray Cumming wrote:
Murray Cumming wrote:
On Sun, 2006-09-17 at 02:41 +0100, Edd Dawson wrote:
[snip]
The book
(http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch08s02.html)
says:

"You must set the cell's editable property to true, like so:

cell.property_editable() = true;"

[ 8< --- snip ]

I think you need to use the "activatable" property.
That's what I suspected but I thought the last line of my code was editing
the
activatable property suitably? I tried replacing it with:

rend->property_activatable() = true;

This made no noticeable difference.

One behavior that I have noticed is that if I leave the activatable
property
alone, the check-box is 'greyed-out'. So is activatable really the same as
editable? It's certainly doing something, but not what I want.

Maybe you are not setting the new value in the model when the check box is
clicked. You need to not only set the cell to editable/activatable, but
respond to the edit/activate action and use (maybe after validating) the
new value. You should find examples of this in various programs, or you
can read the implementations of the add_column_editable() methods, which
also do this.

I have tried connecting a member function to the cell renderer's signal_toggled() slot, which as far as I can see is the only available slot for a CellRendererToggle. This doesn't do a lot i.e. my breakpoint within the slot-function never gets hit.

The thing that's really baffling me is that when I originally had the bool and string in different view columns and added the column using append_column_editable (after following some of the example code), everything worked absolutely fine.

I looked in the treeview.h header for the implementation as you suggested, but it requires the use of machinery that isn't part of the gtkmm client interface. Also, none of the examples have similar functionality i.e. an /editable/ model column bundled with a non-editable model-column in a single view-column.

Is there any reason that you know of as to why doing it this way should be so different/convoluted/non-obvious/un-documented? In case you can't tell, I'm pushing for more information to be made available on this subject with the gtkmm distribution :) This is something I'll be glad to help with if I can ever figure this out.

I'm beginning to think that the functionality is actually missing, or at least not exposed to gtkmm clients as well as it should be. Perhaps I should put together a tiny program in the hope that someone can provide the two-line fix I'm after?!

Edd






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