MenuItem Selected property does not change after Item
selection
EXAMPLE:
var mnu=CreateMenu();
mnu.Items.Add("aaa",false,false,false,OnClickMenu);
mnu.Items.Add("bbb",false,false,false,OnClickMenu);
mnu.Items.Add("ccc",false,false,false,OnClickMenu);
mnu.Title="ICE";
mnu.Show();
function OnClickMenu(mnuItm)
{
Msg(mnuItm.Selected); //always show value difined in
mnu.Items.Add
}
Also not a bug but MenuItem realization does not allow
to use pattern "Command", there is no property in
MenuItem class to put in MenuItem object any other
object, so it's need for a future to add property Tag
in MenuItem class,
so some code like that will be workable
var mnu=CreateMenu();
var tag=new ExecuteFirstMenu();
mnu.Items.Add("aaa",false,false,false,OnClickMenu,tag);
tag=new ExecuteSecondMenu();
mnu.Items.Add("bbb",false,false,false,OnClickMenu,tag);
mnu.Title="ICE";
mnu.Show();
//no searches, if's, switch and etc.. opeartors are needed
function OnClickMenu(mnuItm)
{
mnuItm.Tag.Execute();
}
function ExecuteFirstMenu()
{
}
ExecuteFirstMenu.prototype.Execute=function()
{
//do some work after Execution first menu
}
function ExecuteSecondMenu()
{
}
ExecuteSecondMenu.prototype.Execute=function()
{
//do some work after Execution second menu
}