Jump to content

Action button on TreeView Control


Guest bdmoore

Recommended Posts

Guest bdmoore

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

Link to comment
Share on other sites

  • 2 weeks later...
Guest komplex

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

Link to comment
Share on other sites

Guest bdmoore

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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.