Announcement

Collapse
No announcement yet.

Treeview CDIS_HOT ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Treeview CDIS_HOT ?

    I can have a 'HOT' resonse during ownerdraw when i add the %TVS_TrackSelect style.
    However this style modifies the font and mousepointer.

    I only need to get the CDIS_HOT working without selecting or things as mentioned above.

    ?
    hellobasic

  • #2
    I can have a 'HOT' resonse during ownerdraw when i add the %TVS_TrackSelect style.
    However this style modifies the font and mousepointer.
    ???
    If you are owner-drawing the item, why would you need to preserve a font?

    I only need to get the CDIS_HOT working without selecting or things as mentioned above.
    "hot tracking" is by definition "selecting by hovering [without clicking]" Can't find the doc for the treeview, but under the listview (LVS_EX_TRACKSELECT) it says:
    Hot track selection means that an item is automatically selected when the cursor remains over the item for a certain period of time.
    What are you really trying to do? Highlight the item under the cursor? You can detect that on WM_NOTIFY/NM_CUSTOMDRAW just by gettting the cursor location (GetCursorPos) and seeing if it's on your item (TreeView_HitTest) and draw differently depending on that result.

    ???
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I am now obtaining the font set because TVS_TRACKSELECT make it a hyperlink (and thus underlined)
      By selecting the original font it's gone now.

      >"hot tracking" is by definition "selecting by hovering [without clicking]" Can't find the doc for the treeview, but under the listview (LVS_EX_TRACKSELECT) it says:

      That's the major difference + i was indeed assuming the same behaviour as with a LV.
      The TV does not select it, as i want to.

      >You can detect that on WM_NOTIFY/NM_CUSTOMDRAW just by gettting
      That's a work around i always can resort to, no need to discuss it while i just getting into the native control stuff at this time.

      Frankly, now i know there is a difference between a LV and TV regarding trackselect, i am fine now.
      Will read more about customizing but i only need a normal cursor, which is easy to fix if not nativly supported.
      hellobasic

      Comment


      • #4
        That's the major difference + i was indeed assuming the same behaviour as with a LV. The TV does not select it, as i want to
        Or perhaps are you inadvertently pre-empting the default behavior of TVN_SELCHANGING notification by returning TRUE? (code not shown).

        Hmm, no TVN_HOTTRACK notification or TVM_SETHOVERTIME message listed in my SDK, like there is for the listview. I think I'll check the Microsoft site, as my CD is pretty old (Fall 2002 version),,, nah, online has nothing I don't.

        I wonder if hot track selection is actually supported by the treeview control?

        MCM
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          >I wonder if hot track selection is actually supported by the treeview control?
          I hope not or at least supressable..

          >...TVN_SELCHANGING?
          No, but will read about that..
          hellobasic

          Comment


          • #6
            To be clear: i don't want the select on mousehover.
            And it doesn't but i just wanted to know if i am doing it right and have to read somewhat more.
            Though it's hard to find a topic not seem to exist

            At this time i reset the mouse like this:
            Case %WM_SETCURSOR

            SetCursor( LoadCursor( 0, ByVal %IDC_ARROW ) )
            Function = 1
            Exit Function

            The control is superclassed so it can maintain it's own mouse behaviour.

            hellobasic

            Comment


            • #7
              >To be clear: i don't want the select on mousehover

              Well, then you don't want hot-tracking, unless you make the hover-time impossibly long... assuming you can even set it (no TVM_SETHOVERTIME message to send).

              So what do you want? The item under the cursor with a better visual presentation, as in, "Hey, if you click now THIS will be the selected item?"

              In that case it sounds like all you have to do is lose the TVS_TRACKSELECT style and continue to handle WM_NOTIFY/NM_CUSTOMDRAW.

              >The control is superclassed so it can maintain it's own mouse behaviour.
              Code not shown.

              MCM
              Michael Mattias
              Tal Systems Inc. (retired)
              Racine WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Easssy... ok?

                I am not that dumb, i want to have a mousehover notification for my superclassed ownerdrawn treeview control.
                On mousehover aka 'hot' i want to highlight it.

                At this time everything works as expected however i recall the trackselect for the listview.
                This style enables mousehover but icw selecting the item.

                To enable a hot notification for a treeview it seems you'll need to set the trackselect style, at least that is what i think and so far it works.
                But i don't need any unpredictable results that items are selected on mousehover.
                You of all should appreciate the thoroughness of exploring if this behaviour exists and how to prevent it.

                Ok, it seems i am overdoing it on this matter..

                Again, i have the treeview working as i want, no selection on hot, during hot item is redrawn in the customdraw, mousehand is now a pointer again.. and yes.. that code was shown.
                hellobasic

                Comment


                • #9
                  ???


                  Code:
                   Style =  whatever AND (NOT TVS_TRACKSELECT) 
                  ....
                  CASE WM_NOTIFY
                      CASE CtrlID =mytreeviewcontrol 
                        CASE NM_CUSTOMDRAW 
                           IF GetCursorPos() + treeView_hitTest() = on this item THEN 
                               Draw Hot
                           ELSE
                               Draw Cold
                          ...
                  ???

                  MCM
                  Michael Mattias
                  Tal Systems Inc. (retired)
                  Racine WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    There is *no* customdraw message during mousehover unless the trackselect style is set.

                    I think i explored enough to determine there is no real select on ts style so i am fine.
                    hellobasic

                    Comment


                    • #11
                      True, if you want to wait for 'hover' before "hot-lighting" then you either have to track-select or pick up WM_MOUSEHOVER after TrackMouseEvent().

                      But you should be getting WM_NOTIFY/NM_CUSTOMDRAW every time the cursor moves over that treeview item. I know that happens with listviews and LV and TV have a lot in common.
                      Michael Mattias
                      Tal Systems Inc. (retired)
                      Racine WI USA
                      [email protected]
                      http://www.talsystems.com

                      Comment


                      • #12
                        I am getting nuts here, i found out that i get the LVN_HOTTRACK message and i can invalidate the item to be painted but..., msdn states:
                        "Sent by a list-view control when the user moves the mouse over an item. This notification is only sent by list-view controls that have the LVS_EX_TRACKSELECT extended list-view style. It is sent in the form of a WM_NOTIFY message. "

                        But i don't have this style set, when i do it also sents a NM_HOVER!!!

                        What a mess!
                        hellobasic

                        Comment


                        • #13
                          I think trackmouseevent api for in-and-out notify is the only stable solution i guess.
                          hellobasic

                          Comment

                          Working...
                          X