Tagged: Hints
- This topic has 36 replies, 4 voices, and was last updated 4 years, 4 months ago by HeDiBo.
-
AuthorPosts
-
January 28, 2020 at 3:35 pm #68341HeDiBoParticipant
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.
February 2, 2020 at 9:06 am #68367SupportKeymasterWM_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.
February 2, 2020 at 4:52 pm #68376HeDiBoParticipantI’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, 9 months ago by HeDiBo.
February 2, 2020 at 4:58 pm #68380HeDiBoParticipantA 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, 9 months ago by HeDiBo.
February 3, 2020 at 2:38 pm #68392SupportKeymasterDisabled 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.February 3, 2020 at 7:53 pm #68401HeDiBoParticipantSo, WM_MOUSEHOVER is not sent, even if TrackMouseEvent specifies the parent‘s handle?
February 3, 2020 at 10:18 pm #68406SupportKeymasterYes, It’s sent when mouse is entering to this parent.
Child control just looks like invisible for the mouse and this tracking.February 6, 2020 at 5:05 pm #68428HeDiBoParticipantI’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.February 6, 2020 at 11:05 pm #68431SupportKeymasterThanks. 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?February 7, 2020 at 2:12 pm #68432HeDiBoParticipantIf 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, 9 months ago by HeDiBo.
May 17, 2020 at 4:14 pm #68825HeDiBoParticipantDid you make any progress on this subject?
May 21, 2020 at 7:55 pm #68838SupportKeymasterSorry, no progress there yet.
June 11, 2020 at 12:45 pm #68931HeDiBoParticipantFirst tests in 15.09 suggest you’ve made it π
June 11, 2020 at 1:24 pm #68932HeDiBoParticipantThere’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.June 13, 2020 at 8:35 am #68953SupportKeymasterThank you for the demo, I will check it.
June 23, 2020 at 10:10 am #69008HeDiBoParticipantI really thank you for your effort, but this small irregularity still exists in 15.10
July 24, 2020 at 11:22 am #69135HeDiBoParticipantI think you’ve solved it π
-
AuthorPosts
- The topic ‘Show hints even if control is disabled’ is closed to new replies.