'Better' editing / focus policy in a TreeView



I'd like to set up TreeViews with a different behaviour when editing
stuff in cells.
Currently, you have to hit the Enter key to start editing ( or click in
the cell ). You also have to hit Enter ( or click in another cell ) to
end editing. Then you have to use the cursor keys to move the focus
along, and finally hit Enter to start editing again.

I'd like to get something much more like MS Access' datasheet behaviour,
ie when you hit enter, the focus goes to the next cell and editing
begins. I've been able to get a crippled version of this behaviour
working by connecting a sub to the 'edited' signal of the text renderer
and using $treeview->set_cursor to move the focus along and start
editing. The problem is that this only works well if I only use the
keyboard. If the focus moves somewhere else ( eg if I click in some
other cell or outside the treeview completely ), things get messy. Is
there any way of avoiding this with the current method I'm using ...
connecting to the 'edited' signal of the renderer ... can I detect at
this point that editing has finished for a reason *other* than a
keyboard event? I barely remember making some simple modifications to a
custom CellRendererSpinButton that trapped keypress events and moved the
focus along - this worked much better than my current solution, but I'd
rather not have to have a custom cell renderer in every single cell, as
it over complicates things and performance suffers quite badly with
large data sets.

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au



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