473,394 Members | 1,663 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,394 software developers and data experts.

Single vs. Doucble Click

I would like three states on an icon ...

Left Click
Right Click
Double Click

Left Click is fired at least once on a Double Click

Is there a good example that shows how to determine if the user entered a
Left Click or a Double Click?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #1
14 3510
I am not sure what control you are using but my best suggestion would be to
derive from the control you want to use, and lets just it's the picturebox
control. I would add the three properties you want to keep track of, and
within the onClick, and onDoubleClick methods. I would modify the state of
those three properties.
Keenan
"Thom Little" <th**@tlanet.net> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I would like three states on an icon ...

Left Click
Right Click
Double Click

Left Click is fired at least once on a Double Click

Is there a good example that shows how to determine if the user entered a
Left Click or a Double Click?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #2
Maybe wait for a set period to see if the next click comes?
You would not be able to do this in the event handler but would have to
start a "process" that would be cancelled by the double click.
Maybe start a timer and in the timer event set the click icon and in the
double click event stop the timer.
HTH
JB

"Thom Little" <th**@tlanet.net> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
I would like three states on an icon ...

Left Click
Right Click
Double Click

Left Click is fired at least once on a Double Click

Is there a good example that shows how to determine if the user entered a
Left Click or a Double Click?

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

Nov 16 '05 #3
Hi Thom,

Based on my understanding, you want to distinguish left click with double
click.

Can your tell me what is your "icon"? Is it a WinForm control?

For a control, you may handle this through Control.Click event and
DoubleClick event. Or you may override the control, handle in both OnClick
and OnDoubleClick protected method.

Does this meet your need?

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #4
I am using System.Windows.Forms.NotifyIcon and would like to service events
for ...

Left Click
Right Click
DoubleClick

I do not currently have Left Click enabled.
DoubleClick works fine.
Right Click is assigned to the context menu and it works fine.

If I enable Left Click it is raised ...

Once for a Left Click
Twice for a DoubleClick
Once for a Right Click

Is there an obvious routine for isolating this behavior to easily determine
a ...

Left Click
Left DoubleClick
Right Click
Right DoubleClick

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:0C**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Based on my understanding, you want to distinguish left click with double
click.

Can your tell me what is your "icon"? Is it a WinForm control?

For a control, you may handle this through Control.Click event and
DoubleClick event. Or you may override the control, handle in both OnClick
and OnDoubleClick protected method.

Does this meet your need?

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #5
Hi Thom,

Thanks for your feedback.

Based on my understanding, I think you do not want the single click logic
when double click occurs.

==============================
Actually, in windows system, all events are driven by messages. For mouse
events, if you double click your mouse, the single click message will first
occur for you.
This is by design. Because double click is consistute of 2 single click,
which click internal is less than certain value. When the first single
click occurs, the system can not know if it is a "pure" single click or is
just a "part" of double click. So system also will fire single click for
you.

For your request, the only workaround I can think of is delay the single
click code logic. That is: when single click occurs, we can delay a certain
time, to see if another single click is comming, if it comes, we discard
the single click code, but process the double click logic. But if there is
no another single click occurs, we can just process the single click logic.

The key point is to determine the "certain" time to delay. This time should
be a little longer than the system double click time.(Which is stored in
windows system, you can configure it through control panel). In C#, we can
P/invoke GetDoubleClickTime Win32 API to get this value. Then you can use
Timer control to do the delay.

==============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #6
Hi Thom,

Thanks for your feedback.

Based on my understanding, I think you do not want the single click logic
when double click occurs.

==============================
Actually, in windows system, all events are driven by messages. For mouse
events, if you double click your mouse, the single click message will first
occur for you.
This is by design. Because double click is consistute of 2 single click,
which click internal is less than certain value. When the first single
click occurs, the system can not know if it is a "pure" single click or is
just a "part" of double click. So system also will fire single click for
you.

For your request, the only workaround I can think of is delay the single
click code logic. That is: when single click occurs, we can delay a certain
time, to see if another single click is comming, if it comes, we discard
the single click code, but process the double click logic. But if there is
no another single click occurs, we can just process the single click logic.

The key point is to determine the "certain" time to delay. This time should
be a little longer than the system double click time.(Which is stored in
windows system, you can configure it through control panel). In C#, we can
P/invoke GetDoubleClickTime Win32 API to get this value. Then you can use
Timer control to do the delay.

==============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #7
Thanks for the lead.

I did it with a timer and testing ButtonDown for a Left Click.

I then abandoned the capability.

The icon is too small and the mouse clicking has to be too precise. In
addition the timing will vary from machine to machine and I think it will be
prone to failure.

I settled for double-click and single right click for my application.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:id**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Thanks for your feedback.

Based on my understanding, I think you do not want the single click logic
when double click occurs.

==============================
Actually, in windows system, all events are driven by messages. For mouse
events, if you double click your mouse, the single click message will first occur for you.
This is by design. Because double click is consistute of 2 single click,
which click internal is less than certain value. When the first single
click occurs, the system can not know if it is a "pure" single click or is
just a "part" of double click. So system also will fire single click for
you.

For your request, the only workaround I can think of is delay the single
click code logic. That is: when single click occurs, we can delay a certain time, to see if another single click is comming, if it comes, we discard
the single click code, but process the double click logic. But if there is
no another single click occurs, we can just process the single click logic.
The key point is to determine the "certain" time to delay. This time should be a little longer than the system double click time.(Which is stored in
windows system, you can configure it through control panel). In C#, we can
P/invoke GetDoubleClickTime Win32 API to get this value. Then you can use
Timer control to do the delay.

==============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #8
Hi Thom,

Thanks very much for your feedback.

Do you still have any concern on this issue? If you need further help,
please feel free to feedback, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #9
Thanks for the lead.

I did it with a timer and testing ButtonDown for a Left Click.

I then abandoned the capability.

The icon is too small and the mouse clicking has to be too precise. In
addition the timing will vary from machine to machine and I think it will be
prone to failure.

I settled for double-click and single right click for my application.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:id**************@cpmsftngxa06.phx.gbl...
Hi Thom,

Thanks for your feedback.

Based on my understanding, I think you do not want the single click logic
when double click occurs.

==============================
Actually, in windows system, all events are driven by messages. For mouse
events, if you double click your mouse, the single click message will first occur for you.
This is by design. Because double click is consistute of 2 single click,
which click internal is less than certain value. When the first single
click occurs, the system can not know if it is a "pure" single click or is
just a "part" of double click. So system also will fire single click for
you.

For your request, the only workaround I can think of is delay the single
click code logic. That is: when single click occurs, we can delay a certain time, to see if another single click is comming, if it comes, we discard
the single click code, but process the double click logic. But if there is
no another single click occurs, we can just process the single click logic.
The key point is to determine the "certain" time to delay. This time should be a little longer than the system double click time.(Which is stored in
windows system, you can configure it through control panel). In C#, we can
P/invoke GetDoubleClickTime Win32 API to get this value. Then you can use
Timer control to do the delay.

==============================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #10
Hi Thom,

Thanks very much for your feedback.

Do you still have any concern on this issue? If you need further help,
please feel free to feedback, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #11
I revisited this requirement and tweaked the installation. The final
implementation supports the following actions on an icon in the System Tray
....

Left Click
Left Double Click
Right Click

This was the original design and it operates very nicely.

For the double click time interval I simply use ...

timeLeftClick.Interval = SystemInformation.DoubleClickTime ;

Thanks for the help.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:gn*************@cpmsftngxa06.phx.gbl...
Hi Thom,

Thanks very much for your feedback.

Do you still have any concern on this issue? If you need further help,
please feel free to feedback, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #12
Hi Thom,

Oh, cool, I did not see there is a so easy way to get this value. Cheers!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #13
I revisited this requirement and tweaked the installation. The final
implementation supports the following actions on an icon in the System Tray
....

Left Click
Left Double Click
Right Click

This was the original design and it operates very nicely.

For the double click time interval I simply use ...

timeLeftClick.Interval = SystemInformation.DoubleClickTime ;

Thanks for the help.

--
-- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
--

""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:gn*************@cpmsftngxa06.phx.gbl...
Hi Thom,

Thanks very much for your feedback.

Do you still have any concern on this issue? If you need further help,
please feel free to feedback, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #14
Hi Thom,

Oh, cool, I did not see there is a so easy way to get this value. Cheers!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 16 '05 #15

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

Similar topics

11
by: Thom Little | last post by:
I would like three states on an icon ... Left Click Right Click Double Click Left Click is fired at least once on a Double Click Is there a good example that shows how to determine if the...
0
by: Jeff Louie | last post by:
I am running into a problem using the OpenFileDialog box when single click is enabled. I am running WinXPP SP2, Visual Studio 2003, Windows Forms. I am getting a lot of null exceptions in an...
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
6
by: Sakharam Phapale | last post by:
Hi All, How to capture Mouse Single click and mouse double click event on Commnad Button. I am doing as follows. Private Sub Button1_MouseUp(ByVal sender As Object, ByVal e As...
3
by: Siv | last post by:
Hi, I have a ListView control in a Windows application, currently single clicking a customer name in this list, selects the customer and displays their details in text boxes to the right of the...
2
by: cumars | last post by:
Hello Friends, I want to trigger both the click event and double click event in a single button separately. (i.e.) the user can trigger both the single click and the double...
8
by: starrysky | last post by:
I have a program which puts an icon in the notification area and has a menu associated with it available by right clicking on the icon. I want the menu items to be selected by single left clicks but...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.