Show hints even if control is disabled

Tagged: 

Viewing 17 posts - 21 through 37 (of 37 total)
  • Author
    Posts
  • #68341
    HeDiBo
    Participant

    The WM_MOUSEMOVE message is more handy for that. We should check position of the mouse after each moving.
    WM_MOUSEHOVER can’t do that.

    Both have the cursor position in the lParam parameter. But WM_MOUSEHOVER only occurs once at the right time. Maybe I don’t get your point.

    #68367
    Support
    Keymaster

    WM_MOUSEHOVER is sent once, we will move the mouse inside the control and will not know when child control is hovered by mouse because WM_MOUSEHOVER is not sent anymore.

    #68376
    HeDiBo
    Participant

    I’m not sure you should keep following the mouse.
    As soon as the TrackMouseEvent for the parent control has been given, WM_MOUSEHOVER and WM_MOUSELEAVE can be catched. It’s actually great that the hover event only comes once.
    I think this is a good scenario:

    TrackMouseEvent for the parent control, if that control does not have a hint itself.
    When the hover event occurs, check whether the event is over a disabled control.
    If it is, show the Hint (if any).
    In both cases TrackMouseEvent again.

    It is very well possible that you see problems that I cannot. In that case, I apologize.

    • This reply was modified 4 years, 7 months ago by HeDiBo.
    #68380
    HeDiBo
    Participant

    A nice overview by microsoft:
    docs.microsoft.com/en-us/windows/win32/learnwin32/other-mouse-operations
    A comprehensive set of samples:
    http://www.codeproject.com/Articles/1745/Adding-mouse-functionality-to-any-control

    • This reply was modified 4 years, 7 months ago by HeDiBo.
    #68392
    Support
    Keymaster

    Disabled child control will not be visible for the mouse.
    WM_MOUSEHOVER is sent once when we hovered the parent control. And that’s all. We can call TrackMouseEvent again with different params. But when mouse hovered over a disabled child control nothing happens. WM_MOUSEHOVER will not be sent.

    #68401
    HeDiBo
    Participant

    So, WM_MOUSEHOVER is not sent, even if TrackMouseEvent specifies the parent‘s handle?

    #68406
    Support
    Keymaster

    Yes, It’s sent when mouse is entering to this parent.
    Child control just looks like invisible for the mouse and this tracking.

    #68428
    HeDiBo
    Participant

    I’ve made a small demo project to show you what I mean.
    The left panel shows that mouse move messages arrive in the panel, when the control Edit1 is disabled (they will not arrive if the control is Enabled and the mouse hovers over it).
    The right panel shows that WM_MOUSEHOVER messages appear, if the StartMouseEvents function is called, when the mouse cursor is over the panel. In that case, they also appear when the Edit2 control is disabled and the mouse cursor is over the edit box.

    Attachments:
    You must be logged in to view attached files.
    #68431
    Support
    Keymaster

    Thanks. I saw how the TrackMouseEvent procedure works.
    But how we can catch the event when mouse is hovering a child control?

    We should check a mouse position and compare with position of each child control in any case.
    If mouse is above a child control then we can start procedure of hint showing.
    But we can do it with WM_MOUSEMOVE also. How TrackMouseEvent can make it better than WM_MOUSEMOVE?

    #68432
    HeDiBo
    Participant

    If mouse is above a child control then we can start procedure of hint showing.
    But we can do it with WM_MOUSEMOVE also. How TrackMouseEvent can make it better than WM_MOUSEMOVE?

    With WM_MOUSEMOVE, you’ll have to do the hover logic yourself: wait whule the mouse cursor hovers without movement for the hint delay time. That is already worked out in the TrackMouseEvent logic.

    For the general logic, I would concentrate on the setting of the Enabled property to False. Then I would add that control to a list maintained by the parent control, but only if the parent does not have a hint of its own and only if the control added has a hint to show.
    At the moment the cursor enters the parent control, check whether it has a list of controls for which the hint needs to be handled. If it has, call TrackMouseEvent. At WM_MOUSEHOVER time, check whether the cursor is over one of these controls, the parent still has no hint of its own and show the control’s hint.

    This is of course a very sketchy description, there are all kind of details to be taken care of, like when the control’s Enabled property goes to True, but I hope this gives a general idea.

    Keep up the good work 🎈

    • This reply was modified 4 years, 7 months ago by HeDiBo.
    #68825
    HeDiBo
    Participant

    Did you make any progress on this subject?

    #68838
    Support
    Keymaster

    Sorry, no progress there yet.

    #68931
    HeDiBo
    Participant

    First tests in 15.09 suggest you’ve made it πŸ’Ž

    #68932
    HeDiBo
    Participant

    There’s still a little quirk left.
    In the attached project hover the mouse over “Toggle sButton1” and move it outside the button area: the parent hint shows.
    Do the same for “sButton1”: the hint of sButton1 shows, but moving the mouse outside the button area does not show the parent hint.

    Attachments:
    You must be logged in to view attached files.
    #68953
    Support
    Keymaster

    Thank you for the demo, I will check it.

    #69008
    HeDiBo
    Participant

    I really thank you for your effort, but this small irregularity still exists in 15.10

    #69135
    HeDiBo
    Participant

    I think you’ve solved it πŸ‘

Viewing 17 posts - 21 through 37 (of 37 total)
  • The topic ‘Show hints even if control is disabled’ is closed to new replies.