By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,685 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Single vs. Doucble Click

P: n/a
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
Share this Question
Share on Google+
14 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.