Guest bdmoore Posted January 9, 2004 Report Posted January 9, 2004 Hi, Can anyone tell me how to capture the action button being pressed for a TreeView control? Neither the Click or KeyDown / KeyPress events seem to pick this up! Cheers, Ben
Guest komplex Posted January 20, 2004 Report Posted January 20, 2004 Click is not supported but AfterSelect is. Try this code as an example. it requires a textbox and treeview to work of course. private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { switch((e.Action)) { case TreeViewAction.ByKeyboard: textBox1.Text = "Keyboard"; break; case TreeViewAction.ByMouse: textBox1.Text = "Mouse"; break; case TreeViewAction.Collapse: textBox1.Text = "Treview Collapsed"; break; case TreeViewAction.Expand: textBox1.Text = "Treview Expanded"; break; case TreeViewAction.Unknown: textBox1.Text = "Unknown"; break; } } Terry
Guest bdmoore Posted January 21, 2004 Report Posted January 21, 2004 Thanks for the response komplex :lol: I got round the problem a different way - I used OpenNetCFs ApplicationEx - it allows you to trap specific windows messages - something that MS should have included :D cheers, bdmoore
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now