Capturing TAB in a Gtk# TreeView widget
I have created a TreeView which is actually what it could be called a TableStringView: there are various cells in which text can be entered.
I'd like to go from one cell to another one by pressing TAB, instead of pressing ENTER and clicking in another cell, as if it were a spreadsheet.
However, when I add a key listener to the TreeView, it fails. The TAB is naturally used to change among widgets, so it is captured before the TreeView has the chance to do anything. So I am looking to something resembling the Windo开发者_运维技巧ws member AcceptsTab:
tvTable.AcceptsTab = true;
Or maybe the Gtk.CellRendererText that will be used for each column:
var cell = new Gtk.CellRendererText();
cell.AcceptsTab = true;
//...
column.PackStart( cell, true );
tvTable.AppendColumn( column );
Unfortunately, no members like these appear to exist. What can I do in order to capture TAB's in a TreeView?
Have you tried using the Glib.ConnectBefore attribute in the keypress handler?
/* ... */
cell.KeyPressEvent += onCellKeyPress;
[GLib.ConnectBefore]
void onCellKeyPress(object sender, EventArgs e)
{
/* ... */
}
精彩评论