Results 1 to 7 of 7

Thread: [RESOLVED] Firing an event on listview > columnheader > mouse move...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Resolved [RESOLVED] Firing an event on listview > columnheader > mouse move...

    Hi guys,

    Does anyone have a trick to catch when the mouse is over a listview column header ? As you know there is no native handler that would fire such event...

    I have build a small routine that will be able to tell over which column the mouse actually is, the problem remains in which event to put it...

    Thanks in advance if you can help

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    PS. For info, the routine looks something like this :


    Code:
    EDIT: Obsolete code.. was not used to find the real method


    So basically I get the header's handle, then rectangle area, to be able to compare with mouse position..
    I just need to put it 'somewhere' now...., hope someone has an idea =)
    Last edited by castaway; Jun 28th, 2011 at 11:03 PM. Reason: remove useless code

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    I might use the WndProc and WM_MOUSEMOVE (?)

    Will check that tomorrow....

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    Well.......

    Neither the WM_MOUSEMOVE nor the WM_NCMOUSEMOVE message fires when moving the cursor over the header..

    Anyone would have an idea how to catch those column header's mouse move ?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    I'm working on subclassing now........ first results are pretty good

    /me like monologs lol

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    I subclassed the column header.
    It looks ok so far : I can catch mouse move events =)

    I'm now trying to use HDM_HITTEST instead of the routine I've done 2 days ago, since it will give me the column index directly..... (will be better)

    I will post the result if I manage to make it work.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jul 2009
    Posts
    85

    Re: Firing an event on listview > columnheader > mouse move...

    Ok I finally managed to do everything....
    Here's what needs to be done, just in case someone needs that information one day or another :

    - Subclass the Header control, assigning the header's handle to the subclass's instance
    - Listen for WndProc messages. Catch WM_MOUSEMOVE events
    - Use HDM_HITTEST to be able to find out which column we are over. The result will be in "<hittest>.iItem"

    - (Write the code you need from that point)



    I needed to have mouse move events to be able de ownerdraw properly a listview header.
    My listview Column header now look similar to the systems column header, that is, with the help of uxtheme.dll and "DrawThemeBackground" etc.. I could reproduce the exact same drawing as windows does with all listview header state (hot, normal, pressed etc....)

    Hope this can help someone one day, it took me quite a while to figure out..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width