15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Menu/toolbar/statusbar interoperability

Lisa Lombardo -- lombardo@stealth.webo.dg.com
Wednesday, May 22, 1996

VC++ 4.1 / MFC 4.0 / Windows NT 3.51 sp4

I am working on dynamically adding toolbar buttons and menuitems
to my Tools pulldown menu from my menubar of my CFrameWnd.

Well, I can get the MenuItem added to the appropriate menu,
but how do I set the "prompt" string (if I were using the menu editor)
for the dynamically added menu item to display in the status bar?
I could not find anything in CMenu class for defining the prompt
string.  

Are there any code sample of dyanmic toolbars and menuitems?

My design is to read the necessary information out of the registry.
The items are placed there by an application that wants to be 
included on my Tools Menu and Toolbar.

Lisa Lombardo
lisa_lombardo@dg.com




Niels Ull Jacobsen -- nuj@kruger.dk
Wednesday, May 29, 1996

[Mini-digest: 4 responses]

At 13:50 22-05-96 -0400, you wrote:
>VC++ 4.1 / MFC 4.0 / Windows NT 3.51 sp4
>
>I am working on dynamically adding toolbar buttons and menuitems
>to my Tools pulldown menu from my menubar of my CFrameWnd.
>
>Well, I can get the MenuItem added to the appropriate menu,
>but how do I set the "prompt" string (if I were using the menu editor)
>for the dynamically added menu item to display in the status bar?
>I could not find anything in CMenu class for defining the prompt
>string. =20

The prompt strings are normally read from
string resources. The menu editor is just smart enough to=20
allow you to edit them simultaneously with your menus.

Override CFrameWnd::GetMessageString to change them.

If you want to provide tool tips as well, you'll
have to add a handler for TTN_NEEDTEXTW and TTN_NEEDTEXTA in=20
your frame window. Use CFrameWnd::OnToolTipText as a starting point.

>Are there any code sample of dyanmic toolbars and menuitems?
Dynamenu handles dynamic menus and prompt strings.
CtrlBars customises a tool bar.

>
>My design is to read the necessary information out of the registry.
>The items are placed there by an application that wants to be=20
>included on my Tools Menu and Toolbar.
>
>Lisa Lombardo
>lisa_lombardo@dg.com
>
>
>
>
Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk)
Everything stated herein is THE OFFICIAL POLICY of the entire Kruger grou=
p
and should be taken as legally binding in every respect. Pigs will grow
wings and fly.

-----From: "Frederic Steppe" 

Override your frame window's virtual void GetMessageString(UINT nID, CString& 
rMessage).
Fill rMessage with the prompt for the given ID, or call the base class for 
static items.


Frederic Steppe (frederics@msn.com)
-----From: Christophe Nasarre 

You should overload CFrameWnd::GetMessageString(UINT nID, CString& rMessage).
nID is the ID of menu item/toolbar button and rMessage is the line you
want to be prompted : you just have to fill it.


Good luck

   -- a poor lonely frenchy --



-----From: David.Lowndes@bj.co.uk

Lisa,

The "prompt" strings are simply string resources with the same
identifier as the menu item.

>My design is to read the necessary information out of the registry.
The items are placed there by an application that wants to be 
included on my Tools Menu and Toolbar.

Are there any code sample of dyanmic toolbars and menuitems?
<
There's a sample called DYNAMENU mentioned in the VC4 help files.

I think GetMessageString is the routine to override to implement
the menu pompt string.

Dave Lowndes




| Вернуться в корень Архива |