04-23-2009 11:08 AM
I am attempting to create an OI for TestStand, and would like to add a file menu item. I copied the code from the full-featured example and it works, the menu items are present but they are all dimmed except the "Exit" item. I changed the IsEditor property of the Application manager to true and the "Save As..." menu item is now active. What needs to be done to get the menu items such as load sequence file, ect. active?
I have included the code which is pretty much copied from the full-featured example
axTheSequenceFileViewMgr.ConnectSequenceFileList(axSequencesComboBox, false);
axTheSequenceFileViewMgr.ConnectCommand(axStartTestButton, CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0, CommandConnectionOptions.CommandConnection_NoOptions);axTheExecutionViewMgr.ConnectExecutionView(axTheSequenceView,
ExecutionViewOptions.ExecutionViewConnection_NoOptions);// start up the TestStand User Interface Components. this also logs in the user
this.axTheApplicationMgr.Start();// avoid flicker that was introduced with .NET 2.0
Menus.BeginUpdate(this);// discard any current menu items that were inserted by Menus.InsertCommandsInMenu
Menus.RemoveMenuCommands(this.uxMainMenu, false, false);// rebuild File menu
ArrayList fileMenuCommands = new ArrayList();fileMenuCommands.Add(CommandKinds.CommandKind_DefaultFileMenu_Set); // add all the usual commands in a File menu
Menus.InsertCommandsInMenu(fileMenuCommands, this.uxFileMenu, null, (object) this.axTheApplicationMgr, true);// remove duplicate separators and shortcut keys
Menus.CleanupMenu(this.uxMainMenu);Menus.EndUpdate();
// localize strings in top level menu items and controls
this.localizer = new Localizer(this.axTheApplicationMgr.GetEngine(), this.axTheApplicationMgr);this.localizer.LocalizeForm(this, "TSUI_OI_MAIN_PANEL", true);
Solved! Go to Solution.
04-24-2009 12:47 PM
whizzs,
It would make sense to me that you would see the options greyed out if you didn't log in when presented the Login/Logout dialog. In your code you are starting the ApplicationMgr which should take care of prompting with the dialog but how are you actually logging in and does the user you are logging in with have permissions to access these functions?
Regards,
Steven Zittrower
Applications Engineer
National Instruments
04-27-2009 01:43 PM
04-28-2009 03:12 PM - edited 04-28-2009 03:12 PM
whizzs,
What you are missing and what needs to be added is the following...
You need the following line in the InitializCompoment () function (or if you can't put it there at least in the MainForm_Load ())
this.MenuStart += new System.EventHandler(this.MainForm_MenuStart);
In addition you will need to match the function prototype exactly, which needs to be somewhere in your MainForm
}
Regards,
Steven Zittrower
Applications Engineer
National Instruments
04-29-2009 09:14 AM