NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding images to OI buttons(C# .net)

Hello all

 

I just want to change the look and feel of the buttons in operator interface Like Break/Resume, logout etc. buttons.

 

I.e. I want to set background images for these buttons. Basically in .net, button controls have a property background image to achieve this but for the test stand ActiveX button I couldn't find any these kinds of properties is there any way to do it??

 

And need one more clarification

 We want to enter some notes in between the test process, or end of test sequence (i.e. notes - the reason for the test pass/fail) is there any way to achieve this??

 

0 Kudos
Message 1 of 7
(3,748 Views)

The TestStand UI Buttons do not expose any methods or properties to change a background image.  If you wish to have this behavior, you will have to create your own controls, and respond to Events coming from the Manager Controls to update the controls (text/visibility/etc...).

If you wish to add notes, I would suggest adding code to the process model (if you wish to have this functionality to every sequence and change the testing process), or in a model callback (if you wish to have this functionality in only some sequences). 

Let me know if you need any more details on these topics.

Allen P.

NI

0 Kudos
Message 2 of 7
(3,743 Views)

Hi thanks allen

 

I have used this command

axSequenceFileViewMgr.ConnectCommand(axEntryPoint1Button , CommandKinds.CommandKind_ExecutionEntryPoints_Set, 0, CommandConnectionOptions.CommandConnection_NoOptions);

 

when I try to pass windows button control as 1st parameter  in the function it throws me a exception “INVALID CAST EXCEPTION”, ie. It is accepting only the National instrument ActiveX Button controls right??

 

How to add properties(backGround Image) to these Activex controls could u please post me some sample code(in C#).

 

Or I have button control which has all the properties how to use this one for the above purpose?

 

And regarding the second one u r talking about the sequence , I want to enter notes for each and every test step in the sequence  and also at the end of the sequence ?? can u send me some sample regarding on this.

 

Thanks & Regards,

Srini

0 Kudos
Message 3 of 7
(3,737 Views)

Srini,

You are correct, the manager controls only know how to accept the TestStand UI Button Controls (or other TestStand UI Controls).  As I posted in the first message, there is no property or method exposed in these controls that will allow you to set a background image.

As an alternative, you can create your own control, and rather than using the ConnectCommand API method, create your own callback function on an event, and use the function ApplicationMgr.GetCommand(....) (or other managers depending on the command),  and Command.Execute.  Since the button is not hooked up to your manager controls, you will also have to manage when to make this control visible or disabled, and when to change the text of the button.  The best place to do this is through the Events of the Manager Controls.

If you would like to execute some piece of code after every step, you would want to insert PostResultListEntry.  You can do this at the Sequence File or Process Model level.  By putting it in the Sequence File, this behavior will happen for every step (that is recording results).  For this example, I am just putting the notes into the ReportText field for each step.  I am ignoring the notes regarding the Sequence Execution, but you could insert code here to do this.

Let me know if you have any more questions.

Allen P.

NI

 

0 Kudos
Message 4 of 7
(3,727 Views)

Again Thanks Allen,

 

My second problem has been solved either I can modify PostUUT call back or put a message box in between the test steps.

 

But I am struggling with first problem, will it be difficult to use my own control and commanding the teststand through applicationmanager.Getcommand method. Because I have to look the state of the button in each and every process (like visible/text/disabled) as you have told like.

 

Is it possible for you to add properties to change a background image of the test stand UI button?

 

Basically I need only two properties

  1. BackGroundImage – normal image

  2. ImageClicked – image has to be shown when user clicks the button

(Look at the Picture attached)

 

If it is possible, change the code (to have these properties) sends me as the dll.

Sorry for the inconvenience.

 

I need these things for the button alone not for every controls.

 

Please…...

Thanks and regards,

Srini

0 Kudos
Message 5 of 7
(3,721 Views)

Sorry the picture attached with this message.

Regards,

Srini

0 Kudos
Message 6 of 7
(3,714 Views)

Unfortunately, it is not possible to change the background image.  However, you can use the event MouseDown if you wish to know when the button is clicked.

It is more difficult to use your own button, but if you look at the old 2.0 Style Operator Interfaces, it will show you the basics on how this type of control was done.

Hope this helps!

Allen P.

NI

0 Kudos
Message 7 of 7
(3,699 Views)