1. FastMenu for Win32Lib
- Posted by cklester <cklester at yahoo.com> Sep 21, 2004
- 444 views
I've created a menu creation library for use with Win32Lib. http://www.cklester.com/euphoria/ It's the first item in the <b>Euphoria Programs & Code</b> section. More details can be found here: http://www.cklester.com/euphoria/?fastmenu After I created it, I found that Win32Lib's new control creation system using newUIObj creates menus almost the same way. Until the IDE starts to use the newUIObj features, I think FastMenu for Win32Lib will still be useful. Derek, I translated menubang.exw to use FastMenu, and here's what it looks like (call it "menubang2.exw" for the win32lib demo library)... <code> -----------------menubang2.exw include win32lib.ew include fastmenu.ew without warning constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 320,200, 0 ), SB = create(StatusBar, "", SimpleWin, 0, {200,-1}, 0, 0, 0) atom defHandler, bangHandler --------------------------------- procedure w32HClick_menu(integer self,integer event,sequence params) --------------------------------- sequence text text = getText(self) setText({SB,1}, text) setText({SB,2}, "") end procedure defHandler = routine_id("w32HClick_menu") --------------------------------- procedure w32HClick_bang(integer self,integer event,sequence params) --------------------------------- setText({SB,2}, "Immediate Action for " & getMenuItem(self)) end procedure bangHandler = routine_id("w32HClick_bang") sequence myMenu myMenu = { {"Options", { "Cold", "Warm", "Hot", "-", "Color" } }, {"!BANG!:" & bangHandler,""}, {"!POW!:" & bangHandler,""} } create_Menu( SimpleWin, myMenu, defHandler ) WinMain(SimpleWin, Normal) </code> Let me know what y'all think. -=ck "Programming in a state of EUPHORIA." http://www.cklester.com/euphoria/
2. Re: FastMenu for Win32Lib
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 21, 2004
- 439 views
- Last edited Sep 22, 2004
cklester wrote: > > I've created a menu creation library for use with Win32Lib. > > <a > href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a> > > It's the first item in the <b>Euphoria Programs & Code</b> section. > > More details can be found here: <a > href="http://www.cklester.com/euphoria/?fastmenu">http://www.cklester.com/euphoria/?fastmenu</a> > > After I created it, I found that Win32Lib's new control creation system > using newUIObj creates menus almost the same way. Until the IDE starts to > use the newUIObj features, I think FastMenu for Win32Lib will still be > useful. Sure will, well done. > Derek, I translated menubang.exw to use FastMenu, and here's what it > looks like (call it "menubang2.exw" for the win32lib demo library)... > > -----------------menubang2.exw > include win32lib.ew > include fastmenu.ew > > without warning > constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 320,200, 0 ), > SB = create(StatusBar, "", SimpleWin, 0, {200,-1}, 0, 0, 0) > > atom defHandler, bangHandler > > --------------------------------- > procedure w32HClick_menu(integer self,integer event,sequence params) > --------------------------------- > sequence text > text = getText(self) > setText({SB,1}, text) > setText({SB,2}, "") > end procedure > defHandler = routine_id("w32HClick_menu") > > --------------------------------- > procedure w32HClick_bang(integer self,integer event,sequence params) > --------------------------------- > setText({SB,2}, "Immediate Action for " & getMenuItem(self)) > end procedure > bangHandler = routine_id("w32HClick_bang") > > sequence myMenu > myMenu = > { > {"Options", > { "Cold", "Warm", "Hot", "-", "Color" } > }, > {"!BANG!:" & bangHandler,""}, > {"!POW!:" & bangHandler,""} > } > > create_Menu( SimpleWin, myMenu, defHandler ) > > WinMain(SimpleWin, Normal) Just for comparision, here is the same routine coded using the built-in Win32lib method.
-----------------menubang.exw include win32lib.ew without warning createForm({ "Window, Simple Window, size=(320,200), Bar=Status=(200,-1)", "Menu, Options", "MenuItem, Cold", "MenuItem, Warm", "MenuSpacer", "MenuItem, Color", "Menu, !BANG!", "Menu, !POW!" }) --------------------------------- procedure w32HClick_menu(integer self,integer event,sequence params) --------------------------------- showMessage({ getText(self), {0,1}} ) showMessage({ "Normal Action", {0,2}} ) end procedure registerRoutine("Click_Cold", routine_id("w32HClick_menu")) registerRoutine("Click_Warm", routine_id("w32HClick_menu")) registerRoutine("Click_Color", routine_id("w32HClick_menu")) --------------------------------- procedure w32HClick_bang(integer self,integer event,sequence params) --------------------------------- showMessage({ getText(self), {0,1}} ) showMessage({"Immediate Action", {0,2}}) end procedure registerRoutine("Click_BANG", routine_id("w32HClick_bang")) registerRoutine("Click_POW", routine_id("w32HClick_bang")) include w32Start.ew
-- Derek Parnell Melbourne, Australia