Menu Bar Question

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Ricardo_V
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Jul 09, 2007 10:01 pm
Location: Vallenar/Coquimbo - CHILE

Menu Bar Question

Post by Ricardo_V »

Hello,

This might be an easy question but so far I'm trying to understand how 'menu_bar' works. I know how yo append items, for example:

Code: Select all

wxMenu *file_menu = new wxMenu;
file_menu->Append(MDI_NEW_WINDOW, _T("&New window\tCtrl-N"), _T("Create a new child window"));
file_menu->Append(MDI_QUIT, _T("&Exit\tAlt-X"), _T("Quit the program"));

wxMenu *help_menu = new wxMenu;
help_menu->Append(MDI_ABOUT, _T("&About\tF1"));

wxMenuBar *menu_bar = new wxMenuBar;
menu_bar->Append(file_menu, _T("&File"));
menu_bar->Append(help_menu, _T("&Help"));

frame->SetMenuBar(menu_bar);
That is OK, but once I run the app a new option appears (Window menu option) between File and Help, which I believe comes from:

wxWindowMenu MENU DISCARDABLE
BEGIN
POPUP "&Window"
BEGIN
MENUITEM "&Cascade", 4002
MENUITEM "Tile &Horizontally", 4001
MENUITEM "Tile &Vertically", 4005
MENUITEM "", -1
MENUITEM "&Arrange Icons", 4003
MENUITEM "&Next", 4004
END
END

Now my question is that I want and need to display each item in spanish. How could I do that?

Thanks in advance.

pd : I'm coding without widgets help, just pure code.
"Whenever possible a dictatorship is the most efficient form of government." -John Carmack
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

You use the _ macro instead of _T for strings to translate, then you extract the strings to translate from the source code using xgettext, and you translate the strings (by filling the generated .po files).

I guess there is a sample about apps localization. You may have a look at it, and look for xgettext in this forum.
Ricardo_V
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Jul 09, 2007 10:01 pm
Location: Vallenar/Coquimbo - CHILE

Post by Ricardo_V »

benedicte wrote:You use the _ macro instead of _T for strings to translate, then you extract the strings to translate from the source code using xgettext, and you translate the strings (by filling the generated .po files).

I guess there is a sample about apps localization. You may have a look at it, and look for xgettext in this forum.
Will find out about xgettext under windows.

But I still don't understand how Window option appears, since it doesn't seem to be called by code. :roll: Is it always included automaticly every time wxMenuBar is created?
"Whenever possible a dictatorship is the most efficient form of government." -John Carmack
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL »

At a guess I suppose you are using the MDI framework, which if memory serves automatically generates the "window" menu item.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
Ricardo_V
In need of some credit
In need of some credit
Posts: 7
Joined: Mon Jul 09, 2007 10:01 pm
Location: Vallenar/Coquimbo - CHILE

Post by Ricardo_V »

NinjaNL wrote:At a guess I suppose you are using the MDI framework, which if memory serves automatically generates the "window" menu item.
Yes I am using the MDI framework, every child window will have their parent from a class derived from MDIParentFrm. So I have no chance to modify that menu item (window)?
"Whenever possible a dictatorship is the most efficient form of government." -John Carmack
Post Reply