NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Menu Items Not Active

Solved!
Go to solution

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);

0 Kudos
Message 1 of 5
(3,337 Views)

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

http://www.ni.com/support

0 Kudos
Message 2 of 5
(3,314 Views)
That is what I thought, the applicationManager.Start() gives me a login prompt and I log in as administrator.  Everything is default so there is no password
0 Kudos
Message 3 of 5
(3,293 Views)
Solution
Accepted by whizzs

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

// The menu has been accessed, rebuild it with currently applicable items
private void MainForm_MenuStart(object sender, System.EventArgs e)
{
this.RebuildMenuBar();

}

 

Regards,

 

Steven Zittrower

Applications Engineer

National Instruments

http://www.ni.com/support

Message Edited by StevieZ on 04-28-2009 03:12 PM
Message 4 of 5
(3,277 Views)
That was it!!! Thanks so much, I didn't see that call back in the VS2008 event callbacks, it's hidden...
0 Kudos
Message 5 of 5
(3,269 Views)