wxWidgets / wxWidgets

Cross-Platform C++ GUI Library
https://www.wxwidgets.org/
5.77k stars 1.7k forks source link

Switch to using TTM_RELAY for tooltips in wxMSW to simplify the code and avoid problems with MFC #24482

Closed wsu-cb closed 1 week ago

wsu-cb commented 4 weeks ago

I have discovered that my previous workaround for #23574 causes some wx tooltips not to be displayed in my full application. Unfortunately, I can't find a small sample that shows the problem.

This PR adds an ugly hack to get the wx tooltips to work in my application, and doesn't obviously make things worse for anything else. However, since this is ugly, and I can't find a simple way to demonstrate the problem, I will understand if this PR is rejected.

vadz commented 4 weeks ago

We also have a similar workaround here, I wonder if we should do this in some other way to ensure that it always happens no matter what...

wsu-cb commented 4 weeks ago

We also have a similar workaround here, I wonder if we should do this in some other way to ensure that it always happens no matter what...

Are you thinking of something like this? I have no experience with hooks, but I am willing to make an attempt using that technique.

wsu-cb commented 4 weeks ago

Wait a minute: Wouldn't using TTF_SUBCLASS avoid the need for these workarounds (by avoiding the need for TTM_RELAYEVENT)? Why doesn't wxMSW use TTF_SUBCLASS instead of requiring TTM_RELAYEVENT?

vadz commented 3 weeks ago

Wait a minute: Wouldn't using TTF_SUBCLASS avoid the need for these workarounds (by avoiding the need for TTM_RELAYEVENT)? Why doesn't wxMSW use TTF_SUBCLASS instead of requiring TTM_RELAYEVENT?

I don't remember. I think there was some problem with using it, but this was back in Windows XP (if not earlier!) days, so whatever it was, it might not exist any more. If you'd like to try to change the code to use TTF_SUBCLASS, and if it works, I think we can try making this change.

wsu-cb commented 2 weeks ago

I have tried using TTF_SUBCLASS instead of TTM_RELAYMESSAGE, and it fixes the problem I was having, simplifies the code overall, and, as far as I can tell, does not create any new problems.

vadz commented 2 weeks ago

Could you please make a PR with your changes? TIA!

wsu-cb commented 2 weeks ago

Could you please make a PR with your changes? TIA!

The force-push https://github.com/wxWidgets/wxWidgets/commit/5d12a154e7ccda6534beab7ff5ec140ce66524de is the modified code.

vadz commented 2 weeks ago

Oops, sorry, I hadn't realized this PR was changed.

It looks fine to me and if it works, I'm for merging it. Any objections from anybody?