NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable an image on a button object

Solved!
Go to solution

Hi folks,

 

This seems like such a simple thing, but I'm stumped.

The end result I'm looking for is a "Terminate All" button on my TestStand UI with a little red square and three dots instead of a caption. I'm using TS2020 x64.

This UI will be used primarily in Thailand and China, and no matter what I've tried I can't get a simple, language-agnostic icon to appear on my button.

The application will test UUTs indefinitely in parallel until the operator terminates all sockets.

 

The first thing I tried:

  • I've created a new TestStand ActiveX button object on the UI
  • I've connected the button to the Execution View Manager as CommandKind_TerminateAll
  • I've enabled the CommandConnectionOption CommandConnection_EnableImage

 

Another thing I tried:

  • Engine.Images.FindImage with "NI_UI_Controls\dbg_terminate_all.ico". This gives me a picture object
  • I tried attaching the picture object to the button object using both the Image and Image(putRef) properties.

Unfortunately the FindImage method and the Image property of the button have incompatible types, where one is an interface to an image and the other is an image object.

 

I must be overcomplicating this. Has anyone done something like this successfully?

 

Thanks,

 

Mr. Jim

 

0 Kudos
Message 1 of 3
(916 Views)
Solution
Accepted by topic author Mr._Jim

According to the CommandKinds help, CommandKinds.TerminateAll applies to the ApplicationMgr.

 

I added the following to the full csharp UI example right before the comment // connect controls on the Report tab:

 

this.axApplicationMgr.ConnectCommand(this.axEntryPoint2Button, CommandKinds.CommandKind_TerminateAll, 0, CommandConnectionOptions.CommandConnection_EnableImage | CommandConnectionOptions.CommandConnection_IgnoreCaption);

 

This re-purposed the single pass button to be a terminate-all button with only an icon image.

Message 2 of 3
(884 Views)

Hi James,

 

Thank you so much for your help. I honestly don't know what I was doing wrong but then I did the following with success:

  • Used the Application Manager instead of the Execution View Manager. (With the latter, the command would fire no problem but I couldn't customize the button)
  • I'm using an additional button that I created from scratch instead of a repurposed one, and I had to set the ShowText property once to make the caption disappear. After I did that once, the CommandConnectionOptions appear to work as expected.

This may have been a case of my staring at it too long? In any case it worked, so thanks again.

 

Mr. Jim

0 Kudos
Message 3 of 3
(867 Views)