简体   繁体   English

单击 MFC 气球工具提示的“X”关闭按钮会发送什么事件?

[英]What event is sent by a click on the “X” close button for an MFC balloon tooltip?

I am working on a very big and complex application for Windows written in C++ and using MFC.我正在为 Windows 编写一个非常大且复杂的应用程序,该应用程序用 C++ 编写并使用 MFC。

I am working on this bug, where if a user presses on a balloon tooltip, it won't close, only after a timeout.我正在处理这个错误,如果用户按下气球工具提示,它不会关闭,只有在超时后。

The thing is that I got the NIN_BALLOONUSERCLICK event and managed to close the tooltip, but I can't seem to catch the event raised when the user presses on the "X" button in the upper right corner.问题是我收到了NIN_BALLOONUSERCLICK事件并设法关闭了工具提示,但是当用户按下右上角的“X”按钮时,我似乎无法捕捉到引发的事件。

Can anyone help me?谁能帮我? What event should I look for?我应该寻找什么事件? I've spent around 3 days of searching the Internet, but no one seems to know of a way.我花了大约 3 天的时间在互联网上搜索,但似乎没有人知道一种方法。

If you can tell me how to make the "X" close button disappear, that would be okay, too!如果您能告诉我如何使“X”关闭按钮消失,那也可以!

The reason you can't find any such event is because one does not exist.您找不到任何此类事件的原因是因为该事件不存在。 It is not possible to distinguish between the balloon being closed because the user clicked somewhere on it and the balloon being dismissed because the user clicked specifically on the close ("X") button.无法区分由于用户单击其上某处而关闭的气球和由于用户专门单击关闭(“X”)按钮而关闭的气球。

More information can be found in this article on Raymond Chen's blog: Why don't notification icons get a message when the user clicks the "X" button?更多信息可以在 Raymond Chen 的博客上找到这篇文章:为什么当用户点击“X”按钮时通知图标没有收到消息?

Basically, the event doesn't exist to keep you from doing bad things, like annoying your users.基本上,该事件不存在以防止您做坏事,例如惹恼您的用户。 There's absolutely no reason that you should need to do something different based on how the user dismissed the balloon notification.根据用户关闭气球通知的方式,您绝对没有理由需要做一些不同的事情。

Making the "X" button disappear is definitely the wrong choice.让“X”按钮消失绝对是错误的选择。 Asking for that makes it sound like you're exactly the developer that the Windows Shell team was trying to protect us from.要求这样做听起来就像您正是Windows Shell 团队试图保护我们的开发人员。 Glad someone has our back as unsuspecting users of your application.很高兴有人支持我们作为您应用程序的毫无戒心的用户。 Users like to be able to dismiss things.用户喜欢能够忽略事物。 Usability studies have repeatedly indicate that it's extremely stressful and confusing for users when there is no "Cancel" button.可用性研究一再表明,当没有“取消”按钮时,用户会感到非常紧张和困惑。 You need to work within the constraints of sensible, user-friendly design.您需要在合理的、用户友好的设计限制内工作。

NIN_BALLOONUSERCLICK is the right choice. NIN_BALLOONUSERCLICK是正确的选择。 The tooltip will be dismissed when the user clicks on it.当用户单击它时,工具提示将被关闭。 The documentation explains all of the various notifications that are available in greater detail.文档更详细地解释了所有可用的各种通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM