Hook document scroll direction & line numbers mouse hover

  • - 2014-06-12


    I am working on plugin for Npp and I need to hook one step document scroll and which direction client perform that scroll.
    I tried message "SC_UPDATE_V_SCROLL" but I don't know how to get the direction of scroll.

    Also I'd like to ask you, if it's possible to check if client mouse cursor is over line numbers.
    I looked at scintillia margin, scintillia "SCI_GETCURSOR" (on line numbers is cursor reversed) and winapi "ChildWindowFromPoint", but without succes...

  • cchris

    cchris - 2014-06-12

    About scrolling: the result of scrolling is to change what lines are visible. Justt ask for SCI_GETFIRSTVISIBLELINE and adjust with SCI_DOCLINEFROMVISIBLE (to cater for word wrap and annotations that a plugin could create).

    About mouse on line number margin: first activate the setting off of SCN_DWELLSTART notification. When you get it, it tells you where the mouse pointer is dwelling. Now you know where the margin line number is, because it's margin #0 (leftmost), and get its width from SCI_GETMARGINWIDTH0 (margin is hidden if this returns 0). You now need to check where the client rectangle is to compute the min and max horizontal coordinates for the line number margin, hence whether cursor is there.
    I wish WM_HITTEST could report such info, but they haven't done that afaik.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks