473,382 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

TreeView call perform DBLCLK

Hi. I need to perform DBLCLK on TreeView Node.
I try the following:

[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam,
UInt32 lParam);
private const UInt32 WM_LBUTTONDBLCLK = 0x203;
pTreeNode.TreeView.SelectedNode = pTreeNode;
UInt32 pos = (UInt32)pTreeNode.Bounds.X;
pos |= (UInt32)pTreeNode.Bounds.Y;
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,0,pos);

But don't get response in TreeView.DoubleClick event.
Help me please with this question.
Sonia.
Nov 15 '05 #1
2 2403
Hi Sonia,
UInt32 pos = (UInt32)pTreeNode.Bounds.X;
pos |= (UInt32)pTreeNode.Bounds.Y;
First, these lines look suspicious. You should not only OR the X and Y, but
you should also shift one of them right by 16 bits (don't remember which one
exactly). Second, ensure you should supply the coordinates in the client
coordinate system and not the screen one.
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,0,pos);
What response do you expect? Wouldn't it be simplier to invoke the event
handler method directly?

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Sonia Igla" <so***@mer.co.il> wrote in message
news:6d**************************@posting.google.c om... Hi. I need to perform DBLCLK on TreeView Node.
I try the following:

[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam);
private const UInt32 WM_LBUTTONDBLCLK = 0x203;
pTreeNode.TreeView.SelectedNode = pTreeNode;
UInt32 pos = (UInt32)pTreeNode.Bounds.X;
pos |= (UInt32)pTreeNode.Bounds.Y;
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,0,pos);

But don't get response in TreeView.DoubleClick event.
Help me please with this question.
Sonia.


Nov 15 '05 #2
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote in message news:<#y**************@tk2msftngp13.phx.gbl>...
Hi Sonia,
UInt32 pos = (UInt32)pTreeNode.Bounds.X;
pos |= (UInt32)pTreeNode.Bounds.Y;
First, these lines look suspicious. You should not only OR the X and Y, but
you should also shift one of them right by 16 bits (don't remember which one
exactly). Second, ensure you should supply the coordinates in the client
coordinate system and not the screen one.
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,0,pos);


What response do you expect? Wouldn't it be simplier to invoke the event
handler method directly?

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Sonia Igla" <so***@mer.co.il> wrote in message
news:6d**************************@posting.google.c om...
Hi. I need to perform DBLCLK on TreeView Node.
I try the following:

[DllImport("user32.dll")]
private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32

wParam,
UInt32 lParam);
private const UInt32 WM_LBUTTONDBLCLK = 0x203;
pTreeNode.TreeView.SelectedNode = pTreeNode;
UInt32 pos = (UInt32)pTreeNode.Bounds.X;
pos |= (UInt32)pTreeNode.Bounds.Y;
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,0,pos);

But don't get response in TreeView.DoubleClick event.
Help me please with this question.
Sonia.


Thank you Dmitriy for your help.
Now I use the following with nothing success:

static IntPtr MakeLParam(int LoWord, int HiWord)
{
return (IntPtr) ((HiWord << 16) | (LoWord & 0xffff));
}
TreeView trv = pTreeNode.TreeView;
trv.SelectedNode = pTreeNode;
Point point = trv.PointToClient(new
System.Drawing.Poin(pTreeNode.Bounds.X,pTreeNode.B ounds.Y));
UInt32 pos = (UInt32)MakeLParam(point.X,point.Y);
SendMessage(pTreeNode.TreeView.Handle,WM_LBUTTONDB LCLK,MK_LBUTTON,pos);
What response do you expect?
I will response in:

treeView1.DoubleClick += new
System.EventHandler(treeViewOnDoubleClick);
private void treeViewOnDoubleClick(object sender, System.EventArgs e)
{
MessageBox.Show("My DBLCLICK");
}

Wouldn't it be simplier to invoke the event handler method directly?


Can you tell me more practice?

Thanks Sonia
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
0
by: Sonia Igla | last post by:
Hi. I need to perform DBLCLK on TreeView Node. I try the following: private static extern int SendMessage(IntPtr hWnd, uint msg, UInt32 wParam, UInt32 lParam); private const UInt32...
1
by: kiran | last post by:
I cratee a form to meet the fallowing requirement. 1. If any node is selected the corresponding checkbox should be checked 2. If any checkbox is clicked the corresponding node should be selected ...
4
by: Aidan Marcuss | last post by:
I am seeing significant performance problems with the TreeView (from the Microsoft.Web.UI.WebControls namespace) when trying to data bind it on the server side. I set the TreeNodeSrc property and...
14
by: Evan Kontos | last post by:
I am trying to implement a Treeview w/an XML file and I even copied and pasted examples from MSDN but can't get them to work. Any suggestions welcome. XML File <TREENODES> <TREENODE...
4
by: pmcguire | last post by:
I have a treeview with a lot of nodes. I want to load only the nodes that are initially visible when the form loads, and then continue to populate it in background and/or when the nodes are required...
6
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using...
4
by: Andrew Robinson | last post by:
I am using a TreeView to perform navigation and have a few nodes that need to generate a popup menu. For this, I use the SelectedNodeChanged event and then add the relevant "window.open" script to...
1
by: =?Utf-8?B?Rmx5Z3V5?= | last post by:
I have a TreeView with so many nodes that it requires scroll bars. When the user selects a node the screen is refreshed and the selected node is no longer visible. The TreeView is opened to the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.