We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

TreeViewAdv node editing and BarItem''s Shortcut

Hi all, I have a scenario where a BarItem''s Shortcut interferes with keys to be handled by the TextBox of a TreeViewAdv node editing. In my sample there is a TreeViewAdv with LabelEdit=true, and a toolbar containing a delete command (a BarItem with Shortcut=''Del''). See my attached sample: while a node in the tree is in editing mode, the Delete key is pressed on the keyboard. The click handler of the BarItem will be processed as first, then the delete is processed by the TextBox. My problem now ist, that in my real world scenario, the BarItem''s job is to delete the selected node; and this happens while the user hits the delete key simply to delete characters in the TextBox. Is there a problem with keyboard message routing? Shouldn''t the TextBox handle the delete key exclusively? Thanks in advance, Christian

TreeViewEditing.zip

2 Replies

DT Deepa TS Syncfusion Team December 7, 2005 08:48 AM UTC

Hi Christian, Thanks for the test sample. I do see the above mentioned problem here. But this is a standard behavior and it is how the .NET MainMenu behaves too(please refer to Form2 in the modified sample attached below). The workaround here is to handle the TreeViewAdv''s BeforeEdit event, set the BarItem''s Shortcut to None, and listen to the node''s edit TextBox''s Leave event. Within this Leave event handler set the BarItem''s Shortcut back to Del. Please refer to the code snippet below that illustrates this : TextBox editbox; private void treeViewAdv1_BeforeEdit(object sender, Syncfusion.Windows.Forms.Tools.TreeNodeAdvBeforeEditEventArgs e) { this.editbox = e.TextBox; this.editbox.Leave +=new EventHandler(editbox_Leave); this.barItem1.Shortcut = Shortcut.None; } private void editbox_Leave (object sender, EventArgs args) { this.barItem1.Shortcut = Shortcut.Del; } Please refer to the attached sample and let me know if this works for you. We appreciate your interest in Syncfusion products. Regards, Deepa.T.S

NodeEditing.zip


DT Deepa TS Syncfusion Team December 7, 2005 08:50 AM UTC

Hi Christian, You can also refer the KB article link given below for this issue. http://www.syncfusion.com/support/kb/tools/Default.aspx?ToDo=view&questId=252 Regards, Deepa.T.S

Loader.
Live Chat Icon For mobile
Up arrow icon