NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ToolBar Button State

Hello,
 
i am working on the TestStand 4.0 User Interface with C#.
 
Now i have built a ToolBar under the MainMenu. I can invoke the Commands by clicking ToolBar Buttons, and get the actual state (enable/disable) of most buttons, except Cut/Copy/Paste.
 
I don't think that the TestStand API or UI provides any method to indicate the custom UI Controls state. My last hope is to catch all WM_LBUTTONDOWN and WM_RBUTTONDOWN messages in the Sequence- and Variable-View. If something editbar is selected, set the Cut/Copy/Paste state to enable.
 
Have somebody better idea? Thanks!
Regards
MY
0 Kudos
Message 1 of 4
(3,498 Views)

I'm not 100% sure I understand your problem, but here are somethings to consider.

- the Enabled property of a Cut/Copy/Paste/Delete Command varies dynamically according to the current selection and focus. Make sure your toolbar or toolbar buttons do not steal the focus.  

- Are you using TestStand buttons? In 4.0, you can set the button image and you can set Button.Style to ButtonStyle_ToolBar. If this works for you, it could save some work.

- If you aren't using TestStand buttons, then you need to decide when to dim or enable the buttons. Some options are:

    a) Use a timer to periodically update them. It is okay if there is a slight lag because even if the button is still enabled when it shouldn't be, the command will be correctly enabled/disabled when the button invokes it..

    b) For each native button, connected the same command to a TestStand button that you hide. Handle the ConnectionActivity event for the TestStand button and update the corresponding native button in the handler.

 

Message 2 of 4
(3,485 Views)
Hi, James Grey,
 
thank you for your reply. English is not my mother tongue languageSmiley Sad
 
I have used the ToolStrip in Visual Studio 2005.
 
I have tried setting a timer with interval of 2000 ms, it worked, but i don't think it is a efficient way. You know, the TS 4.0 is using much memory.
 
I will try your suggestion (b), it is really a clever solution.
Regards
MY
0 Kudos
Message 3 of 4
(3,475 Views)
Hi, James,
 
it works, so great, thank you!
Regards
MY
0 Kudos
Message 4 of 4
(3,454 Views)