on 10-15-2008 4:06 PM
Hi,
I'm adding new menu options in "Main menu" when the application is starting, but the screen shown the refresh of this action being so horrible to the look of users.
To avoid this I try to Freeze the form (169,1) before the add, but the menu items don't appear, anybody know how can i add menu items without showing the refresh.
Thanks!
Thanks for your help Owen!!!
My problem was that i didn't use the instruction "Form.Update"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mariano,
The easiest way to load menus is to freeze the main menu and load all menus from XML. Here's a C# example:
private void AddMenus()
{
XmlDocument oXML;
string sXML = "";
// Get reference to the Main Menu form
SAPbouiCOM.Form sboForm = _sboApp.Forms.GetFormByTypeAndCount(169, 1);
// Freeze it
sboForm.Freeze(true);
try
{
// Load the menus to the SBO application in one batch
oXML = new XmlDocument();
oXML.Load(System.Environment.CurrentDirectory.ToString() + "\\Menus\\" + MENU_FILE);
sXML = oXML.InnerXml.ToString();
_sboApp.LoadBatchActions(ref sXML);
}
finally
{
// Unfreeze and update the Main Menu form
sboForm.Freeze(false);
sboForm.Update();
}
}
And here's an example XML file:
<Application>
<Menus>
<action type="add">
<Menu Checked="0" Enabled="1" FatherUID="8192" String="My Popup Menu" Type="2" UniqueID="MYMENU1" Image="">
<Menus>
<action type="add">
<Menu Checked="0" Enabled="1" FatherUID="MYMENU1" String="My Submenu 1" Type="1" UniqueID="MYSUBMENU1"/>
<Menu Checked="0" Enabled="1" FatherUID="MYMENU1" String="My Submenu 2" Type="1" UniqueID="MYSUBMENU2"/>
</action>
</Menus>
</Menu>
<Menu Checked="0" Enabled="1" FatherUID="2304" String="My Standard Menu" Type="1" Position="4" UniqueID="MYMENU2"/>
</action>
</Menus>
</Application>
Kind Regards,
Owen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.