WindowMenu(MyWin)

BlitzMax Forums/BlitzMax Beginners Area/WindowMenu(MyWin)

MOBii(Posted 2014) [#1]
All the Example use: WindowMenu(MyWin)
FileMenu = CreateMenu("&File", MM_FILE, WindowMenu(MyWin))
Field want a TGadget.
I test use the MyWin:TGadget directly and it's working:
FileMenu = CreateMenu("&File", MM_FILE, MyWin)
Why use: WindowMenu(MyWin)?
is it somehow wrong to use: MyWin Only?


GfK(Posted 2014) [#2]
Each window, by default has a main menu handle to which all menus are attached - you need to pass this handle to CreateMenu() rather than the window handle itself, in order to add root-level menu items, hence WindowMenu(MyWin).

To add stuff under the File Menu, you'd then use:
Global fileLoad:TGadget
fileLoad = CreateMenu("Load", MM_LOAD, FileMenu)

The Load menu item would then be a child of the File menu.


explosive(Posted 2014) [#3]
I also noticed this behaviour long ago. There's basically nothing wrong using it.

But I'd call this "bad" programming. You might run into trouble as soon as the module gets an update.


GfK(Posted 2014) [#4]
>>You might run into trouble as soon as the module gets an update

I wouldn't concern yourself with Blitzmax getting any major updates anytime soon.