简体   繁体   中英

CMFCMenuBar showing wrong tooltips

I have a SDI project with Feature Pack enabled. The program has a Menu Bar ( CMFCMenuBar ) and four Tool Bars( 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.

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?

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:

提示和工具提示文字

In the above example I used:

Open dialogue to manage and modify talk assignments and various appointments\\nManage Talk Assignments

Notice the use of \\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.

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. While the dll dialogs have IDs in range [2000, 2500], the 3 strings have 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.

Even if this worked, I would like to know why, so feel free to edit the answer and add the complete solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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