Connecting Tech Pros Worldwide Forums | Help | Site Map

SendMessage mouse click to treeview node

R.A.F.
Guest
 
Posts: n/a
#1: Nov 24 '07
Hi,

I would like simulate a mouse click on on of my treeview nodes when my
form opens.

for that i was thinking to use the same simple way as under C++ :
SendMessage(TreeView.Nodes[0].Handle, WM_LBUTTONDOWN,0,0);

but it does not work. i do not get any error message and application
runs normally... just my first node is not selected (clicked).

i want to do that because like that, another childform will be selected
based on my treeview node clicked.

thanks a lot,

RAF

KWienhold
Guest
 
Posts: n/a
#2: Nov 26 '07

re: SendMessage mouse click to treeview node


On 24 Nov., 15:47, "R.A.F." <noem...@nospam.comwrote:
Quote:
Hi,
>
I would like simulate a mouse click on on of my treeview nodes when my
form opens.
>
for that i was thinking to use the same simple way as under C++ :
SendMessage(TreeView.Nodes[0].Handle, WM_LBUTTONDOWN,0,0);
>
but it does not work. i do not get any error message and application
runs normally... just my first node is not selected (clicked).
>
i want to do that because like that, another childform will be selected
based on my treeview node clicked.
>
thanks a lot,
>
RAF
Maybe I'm missing something here, but if you want to make sure that
that a specific node is selected when your form opens, why not simply
set the SelectedNode property of the tree?
Since the most common way to use a tree for navigation is to handle
the AfterSelect event, this should result in the same behavior as
actually clicking on the node.

hth,
Kevin Wienhold
Closed Thread