简体   繁体   English

CMFCMenuBar显示错误的工具提示

[英]CMFCMenuBar showing wrong tooltips

I have a SDI project with Feature Pack enabled. 我有一个启用了Feature Pack的SDI项目。 The program has a Menu Bar ( CMFCMenuBar ) and four Tool Bars( CMFCToolBar ). 该程序具有一个菜单栏( CMFCMenuBar )和四个工具栏( CMFCToolBar )。

Toolbars works correctly: I assigned to the TB's buttons the ID of equivalent menu items and I see TB images on menu voices. 工具栏正常工作:我为TB的按钮分配了等效菜单项的ID,并且在菜单声音中看到TB图像。

Now, when I hover on some menu voices (always the same) I got some random tooltips text, I say random because I searched my project and I don't have those two strings written in any part of my solution, for example: 现在,当我将鼠标悬停在某些菜单声音上(总是一样)时,我得到一些随机的工具提示文本,我说是随机的,因为我搜索了项目,并且在解决方案的任何部分都没有写这两个字符串,例如:

图片错误1 图片错误2 图片错误3

I have recently done some manual modification in resource.h file scrumbling some ids... that might be a problem? 我最近在resource.h文件中做了一些手动修改,弄乱了一些ID ...这可能是个问题?

Also, I tried to fix the problem by telling Menu to not show tooltips: 另外,我试图通过告诉菜单不显示工具提示来解决此问题:

dwStile = m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC/* | CBRS_TOOLTIPS*/ | CBRS_FLYBY;
m_wndMenuBar.SetPaneStyle(dwStile);

but, as you can see in the images above, I got no results at all. 但是,如您在上面的图像中看到的,我根本没有任何结果。

Any idea where I can look for the error? 知道在哪里可以找到错误吗?

When you are in the Resource IDE you can specify what the popup text is: 在Resource IDE中时,您可以指定弹出文本为:

提示和工具提示文字

In the above example I used: 在上面的示例中,我使用了:

Open dialogue to manage and modify talk assignments and various appointments\\nManage Talk Assignments 打开对话以管理和修改对话分配和各种约会\\ n管理对话分配

Notice the use of \\n ? 注意使用\\ n吗? That is what splits the two text string components up. 这就是将两个文本字符串组成部分拆分的原因。 Thus, in the final application: 因此,在最终应用程序中:

例

So you should be able to specify all of your text correctly in the IDE editor. 因此,您应该能够在IDE编辑器中正确指定所有文本。

I solved the problem. 我解决了问题。 I found that the "random strings" where the second part (after \\n) of strings stored in the resources of a DLL which my program use. 我发现“随机字符串”的第二部分(在\\ n之后)存储在程序使用的DLL资源中。 While the dll dialogs have IDs in range [2000, 2500], the 3 strings have id: 1, 2, 3. 虽然dll对话框的ID范围为[2000,2500],但3个字符串的ID为:1、2、3。

I don't remember where I read that such low ids might be dangerous so I changed it manually to 3000, 3001 and 3002 and this fixed the problem. 我不记得我在哪里读到过如此低的ID可能很危险,因此我手动将其更改为3000、3001和3002,从而解决了该问题。

Even if this worked, I would like to know why, so feel free to edit the answer and add the complete solution. 即使此方法有效,我也想知道为什么,请随时编辑答案并添加完整的解决方案。

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

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