473,770 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

handle doubleclick without handling click

Dear all,
I am interested in mouse down and double click events of a control.
When doubleclick happens the processing for mouse down should't be done
I did follwing:
sub MyMouseDown(.) handles MouseDown(..)
if e.clicks>1 then return 'This is double click <-----------------(*)
....
end sub
sub DoubleClick(.) handles DoubleClick(..)
end sub

unfortunately when doubleclick happens the simple click seems to happen too.
So (*) don't filter out double clicks.
What is a proper way to handle this problem?
Thanks,
Boni
Nov 21 '05 #1
2 3372
"Boni" <oilia@nospam > schrieb:
I am interested in mouse down and double click events of a control.
When doubleclick happens the processing for mouse down should't be done
I did follwing:
sub MyMouseDown(.) handles MouseDown(..)
if e.clicks>1 then return 'This is double click <-----------------(*)
...
end sub
sub DoubleClick(.) handles DoubleClick(..)
end sub

unfortunately when doubleclick happens the simple click seems to happen
too.
This behavior is by design. Otherwise it would be impossible to raise the
'Click' event directly after the click is performed by the user.
What is a proper way to handle this problem?


You could check if the time distance between the first and the second click
is greater than 'SystemInformat ion.DoubleClick Time', and raise the 'Click'
event after the period has elapsed and no consecutive click was performed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
For a double click be considered a "double-click", the mouse must be clicked
twice within the System.Informat ion.DoubleClick Time property and within the
System.Informat ion.DoubleClick Size area.

The MouseEventArgs has a property that lets you detect the number of clicks
within these parameters, i.e., MouseEventArgs. Clicks.
--
Dennis in Houston
"Herfried K. Wagner [MVP]" wrote:
"Boni" <oilia@nospam > schrieb:
I am interested in mouse down and double click events of a control.
When doubleclick happens the processing for mouse down should't be done
I did follwing:
sub MyMouseDown(.) handles MouseDown(..)
if e.clicks>1 then return 'This is double click <-----------------(*)
...
end sub
sub DoubleClick(.) handles DoubleClick(..)
end sub

unfortunately when doubleclick happens the simple click seems to happen
too.


This behavior is by design. Otherwise it would be impossible to raise the
'Click' event directly after the click is performed by the user.
What is a proper way to handle this problem?


You could check if the time distance between the first and the second click
is greater than 'SystemInformat ion.DoubleClick Time', and raise the 'Click'
event after the period has elapsed and no consecutive click was performed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

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

Similar topics

6
7873
by: R.Wieser | last post by:
Hello All, I'm trying to get a "Virtual Listbox" to work. I've currently got a form, and used CreateWindowExA to create a ListBox with the LBS_OWNERDRAWFIXED and LBS_NODATA flags on it. I've allso subclassed the window and do see all kinds of WS_??? messages coming by. But now I'm stuck :-\ I've got *no* idea what to do next, and all my searching on the web leads me
2
3621
by: JoeHenrich | last post by:
I am using VS.NET 2003 and am having an interesting issue with a Listbox control. Essentially, I have a form with a listbox on it. In the listbox doubleclick event I would like to do some processing and then close the form. However, I receive an error (Cannot access a disposed object named "ListBox".) after my doubleclick code has processed. /* *************************** private void listBox1_DoubleClick(object sender, System.EventArgs...
7
9230
by: Sue & Bill | last post by:
Does a double click action also generate two MouseUp events? If so, what is a good method in my MouseUp event handler to detect that a MouseUp is part of a double click action? Thanks in advance.
5
3141
by: David Lozzi | last post by:
Hey All, I have a listbox that I would like to fire an event on doubleclick. the onDoubleClick property of the listbox isnt available be default, and I know it will work with Javascript, but how do I use javascript to run a server side function? Currently, I am using a Next button to accept the change, but it would be a faster UI to have the option to doubleclick instead. thanks a ton! david lozzi
3
1450
by: Bob | last post by:
My control pops a menu (below, not directly under, the pointer) OnMouseDown, and, probably because of the loss of focus, OnDoubleClick doesn't fire any more. Is there a way to get doubleclick back without some ugly workaround? TIA, Bob
1
4119
by: Marcel Brekelmans | last post by:
Hello, I have implemented a NotiFyIcon and am using both DoubleClick and Click events. But the Doubleclick action on my icon also fires the Click event. Am I missing some setting somewhere or is this normal behavior? I can't find anything about it in the official documentation. Thanks
5
2909
by: celestialgal86 | last post by:
Hi everyone... I'm a starter at .Net programming, and I need some help. I was asked to develop a console app that will auto-hide the console window and show a system tray icon. And by default, the system tray icon on click is supposed to show the console window I know window apps are usually the better solution for handling NotifyIcon class, but I would really like to know how to do it in console apps
3
5707
by: Zytan | last post by:
I can handle DoubleClick on a ListBox to respond, not when the selection changes, but when you double click one to invoke an action. This is the same as using the keys to move the selection, then pressing Enter. But, of course, DoubleClick doesn't automatically handle that. Is there any way to handle ALL standard UI at once, rather than checking for DoubleClick and for Enter press manually? Zytan
3
12301
by: | last post by:
I have a control that need to perform one behavior when it's Clicked and a different behavior when it's DoubleClicked. It seems that you can't get a DoubleClick without first getting a Click. So what's the best way to keep from executing the click functionality before it's determined if it's a double click or not? Or do I just have to "undo" the Click stuff everytime a DoubleClick is received? Thanks. J
0
9617
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10254
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.