HDN_notifcation in derived Clistctrl - Programmer

This is a discussion on HDN_notifcation in derived Clistctrl - Programmer ; Hi, I've a class CMyListCtrl derived from CListCtrl.And I need to use this to handle notifications from all the listctrls in my app's dialog boxes etc.For this I've created a member variable of type CMyListCtrl for the listctrls in the ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: HDN_notifcation in derived Clistctrl

  1. HDN_notifcation in derived Clistctrl

    Hi,
    I've a class CMyListCtrl derived from CListCtrl.And I need to use
    this to handle notifications from all the listctrls in my app's dialog
    boxes etc.For this I've created a member variable of type CMyListCtrl
    for the listctrls in the dialog boxes.
    Problems : A) The hdn_notifications such as HDN_ITEMCLICK
    ,HDN_BEGINDRAG etc does not come to my class.I read somewhere that
    eventhough it is listed in the classwizard it doesnt actually work
    !Any solutions ?
    B) How do i set the styles for the headerctrl ? Can i force the
    list ctrl in the dialog to be of the LVS_REPORT style from my class
    ?Otherwise I've to set it explicitly from the listctrl properties for
    each list.
    C) In which function in my class do i set the color/font
    etc?Initialise the list infact.
    D)Am I doing it wrong in the first place by keeping a member
    variable of my class ?!

    Thanks in advance,
    Sekhar

  2. Re: HDN_notifcation in derived Clistctrl

    "Sekhar" wrote in message
    news:ff4e3765.0310130505.4b81c7d1@posting.google.c om...
    > Hi,
    > I've a class CMyListCtrl derived from CListCtrl.And I need to use
    > this to handle notifications from all the listctrls in my app's dialog
    > boxes etc.For this I've created a member variable of type CMyListCtrl
    > for the listctrls in the dialog boxes.
    > Problems : A) The hdn_notifications such as HDN_ITEMCLICK
    > ,HDN_BEGINDRAG etc does not come to my class.I read somewhere that
    > eventhough it is listed in the classwizard it doesnt actually work
    > !Any solutions ?


    What sort of handler macro does the wizard generate? I seem to recall in
    some cases it erroneously uses ON_NOTIFY_REFLECT instead of ON_NOTIFY, but
    otherwise the notifications should come through. I think for HDN_ITEMCLICK
    you need to handle both the A and the W versions though. There only seems to
    be one version of HDN_BEGINDRAG, but the header needs to have the
    HDS_DRAGDROP style before it is sent.

    > B) How do i set the styles for the headerctrl ? Can i force the
    > list ctrl in the dialog to be of the LVS_REPORT style from my class
    > ?Otherwise I've to set it explicitly from the listctrl properties for
    > each list.


    You can use ModifyStyle I think.

    > C) In which function in my class do i set the color/font
    > etc?Initialise the list infact.


    PreSubclassWindow would probably do, but many times it is advisable to
    PostMessage yourself a custom message in that override instead of making the
    mods directly.

    > D)Am I doing it wrong in the first place by keeping a member
    > variable of my class ?!


    Seems like a sound plan to me.

    --
    Jeff Partch [VC++ MVP]



+ Reply to Thread