problem Handling Click and double click messages in CListView 
Author Message
 problem Handling Click and double click messages in CListView
hi,
I am developing an application in which the frame contains a CListView. I
have to do something when I click on the item as well as when I doubleclick
on the item.
But when I handle both  messages onClick  and OnDblClick only the onclick is
called for both single click and double click.
The thing works if i remove onclick handler. in that case i get proper
notification when i double click on any item
but as soon as i handle onclick as well for both doubleclick as well as
single click only onclick is called.
Can somebody help me out with this.
thanks in advance
regards
rahul



Mon, 09 Aug 2004 23:54:06 GMT  
 problem Handling Click and double click messages in CListView

Quote:
>I am developing an application in which the frame contains a CListView. I
>have to do something when I click on the item as well as when I doubleclick
>on the item.
>But when I handle both  messages onClick  and OnDblClick only the onclick is
>called for both single click and double click.

rahul,

You'll always get the single click event first, regardless of whether
the user has double-clicked. If you're not getting the double click
notification, it may be due to not passing the single click
notification to the default handler.

However, if your single click and double click operations are somehow
exclusive to each other, then you can work around this by delaying
your single click operation.

In your OnClick handler, start a timer that's just a little longer
than the system double click time (GetDoubleClickTime) and put your
existing single click code in the timer handler. If you receive a
OnDblClick notification, kill the timer and do your double click
operation.

Normally it's best to have your double click operation operate on the
normal result of a single click.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Mon, 09 Aug 2004 18:37:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. problem Handling Click and double click messages in CListView

2. mouse up/down vs click/double click delegates

3. Capture click/double-click events from datatable

4. Single click & double click the same button

5. Change the single click to double click?

6. Single-click and double-click handlers

7. Double-Click on CListView column separator

8. double click / single click

9. ListView: Single Click and Double Click

10. Double Click fires two single click events??

11. adding a handler to handle a double click of a button on an application

12. How to add a mouse handler that handles double click events

 

 
Powered by phpBB® Forum Software