|
-
November 4th, 2000, 11:42 AM
#1
CListControl
Hi,
I've inherited CMyListCtrl from, CListCtrl amd I'm tiring to process
notification message from header control that it was clicked.
I’ve subclassed CListControl with CMyListCtrl in dialog, but I never got into this notification message. Property noheadersort do not checked.
What am I doing wrong.
Any help really appreciated.
BEGIN_MESSAGE_MAP(CMyListCtrl , CListCtrl)
//{{AFX_MSG_MAP(CMyListCtrl )
ON_NOTIFY_REFLECT(HDN_ITEMCLICK, OnItemclick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CSortListCtrl::OnItemclick(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
.............
*pResult = 0;
}
-
November 4th, 2000, 06:23 PM
#2
Re: CListControl
Was the list control created in the view's OnCreate or is it a list control created in a dialog (either for a dialog or for a form)?
****************************************************************************************************
Ratings are unimportant but feedback is. Let the helper and the worldwide community know what works, perhaps with ratings.
-
November 4th, 2000, 06:56 PM
#3
Re: CListControl
It is list control for dialog or form.
In that certan case it is in dialog
-
November 4th, 2000, 08:08 PM
#4
Re: CListControl
Ahh... the dreaded header Control again...
First, the header is a child window of the list, so ON_NOTIFY_REFLECT is bad... the Clazz Wizard generates wrong code here.
Change the Message Map Entries to
ON_NOTIFY(HDN_xxx, IDC_yyyy, OnEndtrackList1)
For the IDC_yyy, the header control _typically_ uses 0 as dlg ctrl id.
Good luck
Peter
-
November 5th, 2000, 12:00 AM
#5
Re: CListControl
I think it is strange that there is not a KB article describing this. I looked for one and could not find one. I did find a description of the problem and solution in a different KB article that is remotely related.
http://support.microsoft.com/support.../Q250/6/14.ASP
However I tried it in one of my projects I use for trying things in and it does not work for me. Maybe there is something simple I am overlooking but if so then it probably is not obvious.
****************************************************************************************************
Ratings are unimportant but feedback is. Let the helper and the worldwide community know what works, perhaps with ratings.
-
November 5th, 2000, 09:32 AM
#6
Re: CListControl
Thank you for respond.
I've changed my code as below, but it still doesn't work for me.
What is wromg ?
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CMyListCtrl)
ON_NOTIFY(HDN_ITEMCLICK, 0,OnItemclick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CMyListCtrl::OnItemclick(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
-
November 6th, 2000, 10:10 PM
#7
Re: CListControl
Hello Sam,
Just let you know, if you still interesting in this problem, that I found solution.
ON_NOTIFY(HDN_ITEMCLICKW, 0,OnItemclick) instead of
ON_NOTIFY(HDN_ITEMCLICK, 0,OnItemclick) works. Only one letter but big difference :-).
Best Regards
-
November 6th, 2000, 10:43 PM
#8
Re: CListControl
Then the list control probably was created in an OnCreate and if so you should have said so when I asked.
See: http://support.microsoft.com/support.../Q148/5/33.ASP
Windows 9X will not send a HDN_ITEMCLICKW message. Perhaps it will work to have another message map entry for the HDN_ITEMCLICKA message but if it were me I would use a more generalized solution. Note that one easy solution is simply to not create controls in OnCreate. There are other possibilities too.
****************************************************************************************************
Ratings are unimportant but feedback is. Let the helper and the worldwide community know what works, perhaps with ratings.
-
November 7th, 2000, 08:44 PM
#9
Re: CListControl
This control was not created in OnCreate. It just subclassed standart CListControl which was created by resource editor and it works on Windows 98 as well as on NT. I do not test it on 95.
-
November 7th, 2000, 09:10 PM
#10
Re: CListControl
The HDN_ITEMCLICKW notification message is a Unicode message and Windows 9X does not use Unicode notification messages. The HDN_ITEMCLICKW notification message will not be sent by Windows 9X.
There must be an explanation for why NT is erroneously sending your program Unicode notification messages.
****************************************************************************************************
Ratings are unimportant but feedback is. Let the helper and the worldwide community know what works, perhaps with ratings.
-
November 8th, 2000, 05:01 PM
#11
Re: CListControl
Probably you right theoretically.
But I have to believe to my eyes. This do work on Windows 98.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|