Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click and Double Click events!

Status
Not open for further replies.

Antzz

Programmer
Jan 17, 2001
298
US
Hi,
In winform control, we have code to execute both on the Mouse_Click and Mouse_DoubleClick events but Mouse_Click event fires when user does a double click.

Has anyone come across this issue and how it can be solved?

All help, as always, is appreciated.

A
 
This is common.

As a Hack solution, you can create a timer that calls your function half a second after the click event. If the double click event happens, you stop the timer and use the double click action instead. Its ugly but it works if you have to have both click and double click.
 
Yeap... This is definitely one option that I have evaluated. Is this the only way everybody does it or is there another elegant method?


Thx JurMonkey for the response.
 
can I ask what you have tied to the click event and whats tied to the double click?

I usually just avoid using both on the same object.
 
Of Course. It is based on the user requirements.

The control is a third party Tree control. The tree control just have two levels of nodes and the first level imitates the look of a outlook navigation. The first level single click expands or collapses the nodes while the double click launches a form.

So, what do u guys think?

I apprciate all of you for taking part in this thread. Always interesting to see what others think or have experienced about this.
 
If you only need doubleclick for the second level nodes you can exit the single click event by detecting the node level and the doubleclick event will still get fired if neccesary.

Regards, Ruffnekk
---
Is it my imagination or do buffalo wings taste just like chicken?
 
No click events are required for the second level. Both the single click and double click are at the top level of nodes.

Great feedback guys!!!

Lets keep them coming
 
Is there a property on the 3rd party Tree Control that allows you to Activate a tree node with a single click?

Would it be really difficult to create your own tree control?
 
I think the it will take us some time to develop the tree control we want. We went with a 3rd party tool since this particular one had lots of features and styles.

Oh yes, we also have the source code for this control. So if you had anything in mind, it is possible to we can make changes to it.
 
Perfect.

I would add a property to set the node expansion to 1 or 2 clicks. If it is set to one click, then don't catch the click event. If it is two clicks, then DO catch the event.
 
Out of curiosity, which tree control did you buy? I have been looking at commercial tree controls lately. Not sure if I want to make my own or buy 3rd party just yet.
 
Crownwood. They have a whole suite of tools including a docking framework. The support sucks but at $400.00, you cannot beat the price for the complete source.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top