IonicWind Software

Aurora Compiler => GUI => Topic started by: Ionic Wind Support Team on December 13, 2005, 03:23:55 PM

Title: Menus
Post by: Ionic Wind Support Team on December 13, 2005, 03:23:55 PM
Almost ready for an update.  Featuring the new menu class.

The class works similar to the way the menu macros worked in IB Pro.


        menu m;
m.BeginMenu();
m.MenuTitle("&File");
m.MenuItem("Quit",0,1);
m.MenuTitle("&Options");
m.MenuItem("Clear",0,2);
m.BeginPopup("Line Size");
m.MenuItem("1",0,10);
m.MenuItem("2",0,11);
m.MenuItem("3",0,12);
m.MenuItem("4",0,13);
m.EndPopup();
m.EndMenu();


The nice thing about using a class for handling menu's is that they are reusable and not tied to a particular window.  Context menu creation is also handled by the class.

By not tying it down to a window, or display object, you can have multiple menu variables and swap them on the fly.  Of course to anyone that has used MFC this is nothing new ;)

Title: Re: Menus
Post by: Parker on December 13, 2005, 03:31:55 PM
Do the functions return a handle to the menu item so I can modify them easily? Or at least can they (For a recent files menu)?
Title: Re: Menus
Post by: Zen on December 13, 2005, 03:41:10 PM
Hey thats cool. (You can tell im no MFC programmer ;))

Are most parts of the language now going to be classes? i hope so because it is so much better.

Note: Just incase anyone is interested im making a class to communicate directly with MySQL (No ODBC) i know that there was quite a bit of interest in it on the IB forums.

Lewis
Title: Re: Menus
Post by: Ionic Wind Support Team on December 13, 2005, 03:41:33 PM
Yes.

The menu class has the following functions (as of 5:38pm EST):


declare Attach(unsigned int hMenu);
declare AppendMenu(string item,int flags,int id);
declare CheckMenuItem(int nID,int bChecked);
declare CreateMenu(opt int bPopup = 0);
declare Destroy();
declare Detach(),unsigned int;
declare EnableMenu(int pos,int bEnable);
declare EnableMenuItem(int nID,int bEnable);
declare InsertMenu(unsigned int hMenu,int pos);
declare LoadMenu(string *id);
//high level creation methods
declare BeginMenu();
declare BeginContextMenu();
declare MenuTitle(string name);
declare MenuItem(string name,unsigned int style,int id);
declare Separator();
declare EndMenu();
declare BeginPopup(string name);
declare EndPopup();


You can attach a menu class to an existing hmenu using

m.Attach(hmenu)

Modify it and then use:

hmenu = m.Detach();

The reason for the Detach funciton is the class destroys the internal menu when the variable goes out of scope.  If your using a class variable in, a derived window class for example, you can just refer to m_hmenu

Paul.