Treeview - Mouse Down vs AfterSelect

A

A_PK

Hi,

I need to show particular treeview node detailed infomations based on the
node that user has clicked.

Bascially, the user can expand the treeview, and right click the node to
show a content menu, and user will choose the menu item to perform show
task.

I am using Mouse Down event now....but not sure can use After select or
not....

Using Mouse Down, I am able to let user right or left click and show the
menu. and perform particular task based on user choices. But when i first
click the Treeview, there would be error cos Mouse Down event fire before
Treeview has selected the item. so when I fire the Mouse Down, then my
Treeview is not selected, so I can not get the Treeview item that I
want.....pls help me.

If I use the after select, then how can I show the Right click menu ?
pls help....

How can I get the Treeview selected node that I want when I use Mouse
Down......?
 
D

Daniel Moth

AfterSelect can be handled when a treenode is selected. The event will not
be raised if an already selected node is tapped/clicked on.

If that is good enough for you then you can show a contextmenu with
ContextMenu.Show. Beware of some issues:
http://www.danielmoth.com/Blog/2004/11/contextmenushow.html

If it isn't good enough for you then you need TreeView.NodeMouseClick. Vote
for it:
http://lab.msdn.microsoft.com/produ...edbackid=8bb0f504-037b-4c81-aea0-dfcd25185a43

I guess it could be possible to get notified every time a treenode is tapped
using ApplicationEx in combination with hit testing the treeview via pinvoke
but I have not done it myself.

Cheers
Daniel
 
A

A_PK

Hey Daniel,

where i type treeview or treeview1......i can not find NodeMouseClick on my
desktop version....
pls guide me where can i get the ...
 
D

Daniel Moth

Not sure why you are asking that given the CF context of your first post
but...

.... the answer is that NodeMouseClick is part of .NET 2.0 desktop variant
(but not CF 2.0)...

Cheers
Daniel
 
E

Elmer Miller

I was able to handle this situation in my app by using the ApplicationEx in
combination with HitTest. In my case I needed to know when the user clicked
on the icon of a treeview node so that I could implement my own 'checkboxes'
(I wanted to selectively enable checkboxes on certain nodes so I made my own
icons that correspond to checked, unchecked, notchecked)
The ApplicationEx is fastastic and gets access to the message. Then the
HitTest can figure out which node and what part of the node was clicked. It
works great!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top