Multi CListBox using double-click selection 
Author Message
 Multi CListBox using double-click selection
What approach should I take to make a multiple-selection listbox (a CListBox
object within a dialog box) select an item using double-click instead of a
single-click ? A single click should have no effect other than moving the
caret from one item to another.

Thanks in advance for any help you can provide.

Gerry



Wed, 29 Jun 2005 13:21:28 GMT  
 Multi CListBox using double-click selection

Quote:
>What approach should I take to make a multiple-selection listbox (a CListBox
>object within a dialog box) select an item using double-click instead of a
>single-click ? A single click should have no effect other than moving the
>caret from one item to another.

Gerry,

I'd question why you need to do this - will your users intuitively
know how to use your non-standard behaviour?

Basically you'd need to keep track of the existing selected items so
that you can work out the new selected item.

In the LBN_SELCHANGE handler you would identify the new selected item,
save that position value and call SetSel( Pos, false ) to remove the
selection (this will probably flicker), and in the LBN_DBLCLK handler
you could call SetSel( Pos, true ) to set the selection.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Wed, 29 Jun 2005 15:11:40 GMT  
 Multi CListBox using double-click selection

Quote:
>I'd question why you need to do this - will your users intuitively
>know how to use your non-standard behaviour?

And of course - how will your keyboard users make any selection?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Wed, 29 Jun 2005 15:20:16 GMT  
 Multi CListBox using double-click selection
You can't, at least not easily. This is because a double-click is always a single-click
event followed by a double-click event, and the single-click is constrained to do whatever
a normal single-click does. Since you will not be able to distinguish the first
single-click of a double-click from a single-click, you have to override the single-click
behavior as well. To do this, you have to subclass the control and add handlers for the
single-click and double-click, and not call the superclass methods. And, as has already
been pointed out, you now have a nonstandard interface. This has distinct negative value.
                                        joe

Quote:

>What approach should I take to make a multiple-selection listbox (a CListBox
>object within a dialog box) select an item using double-click instead of a
>single-click ? A single click should have no effect other than moving the
>caret from one item to another.

>Thanks in advance for any help you can provide.

>Gerry

Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Wed, 29 Jun 2005 19:49:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CListbox Double Clicking

2. double click in extended select CListBox

3. Multiple selections using CListBox

4. How to intercept a double click in listview using ATLWIN

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

6. Capture click/double-click events from datatable

7. Single click & double click the same button

8. Change the single click to double click?

9. problem Handling Click and double click messages in CListView

10. Single-click and double-click handlers

11. double click / single click

12. problem Handling Click and double click messages in CListView

 

 
Powered by phpBB® Forum Software