Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CListCtrl : NM_CLICK message handler not getting called

Status
Not open for further replies.

dima2

Programmer
Jan 20, 2002
85
LB
Hi,
I have a dialog based application, in my dialog I placed a CListCtrl and using the class wizard I added a handler for the NM_CLICK message.

my problem is the following:

- when the dialog is first created, clicking on the list for the first time does not call the message handler I have to click a second time for the notification to be handled
- if I hide the list using ShowWindow(SW_HIDE)
and then re-show it using ShowWindow(SW_RESTORE)
the first click (when the list appears) does not generate a notification

what could be wrong??

any help is greatly appreciated
 
Why not handle LBN_* - messages - it works sometimes better?
 
but there isn't an LBN message for click, it's just for double click
 
There are another messages, for example LBN_SELCHANGE.
You can try with LB_* - messages too. I would easy use LB_SETCURSEL by the first showing of List box (with LBN_KILLFOCUS, if You do not need any selection initially).
 
it turned out to be that the first click was setting the focus on the control, and only after that are the NM_CLICK notifications sent.
So all I had to do was to explicitly SetFocus() on the control.

thanks anyway for your reply
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top