Re: AW: Menu Events

Alexander Olk <[email protected]> Fri, 13 Aug 2004 18:20:30 +0200
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <1092414030.3962.11.camel@Dellkiste>
Am Do, den 12.08.2004 schrieb Alexander Gnauck um 22:10:
> I attached the code. I created this small form using wxGlade 0.33 and
> towxnet.exe from the 0.5 binary build. 

First of, MenuItem mnuFileExit wasn't initialized at all... That is why
the programm crashed.
Use mnuFileExit = mnuFileExit.Append(...)
(TowxNET doesn't use the new event system yet...)

Second, put your code that adds menus to the MenuBar after all the other
Menu initialization code:

--- snip --- 
mnuHelp.Append( (int)Cmd.ID_MenuItem_mnuHelpAbout, "About", "",
ItemKind.wxITEM_NORMAL );
			
menubar.Append( mnuFile, "File" );
menubar.Append( mnuHelp, "Help" );
MenuBar = menubar;

//Properties
int[] statusbar_widths = { -1 };
--- snip --- 

Another way to add an EventListener to a MenuItem is:
myMenu.Append(myMenuItem, new EventListener(DoSomething));
or
myMenu.AppendWL(anid, "E&xit", new EventListener(DoSomething));

-- 
Alexander Olk



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285