LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Whitch key is pressed on a Tab control.

Hello ,
 
I want to know which button is pressed on my "Tab control"
 
For example:
 
I have 3 buttons on my front panel and want to use the "event structure" to dectect wich button is pressed.
We don't use the "Value Change" option becaurse we have the added all buttons.
We want do do this with +/- 80 buttons.
 
Can we do this with a user event ?  
 
Does any body knows how to do this ?
 
Regards
 
Michael van den Berg
0 Kudos
Message 1 of 5
(3,402 Views)
Could you be a bit more specific. Typically, the presence of a tab control should have no influence on the rest of the code.
 
Do you have 3 buttons or 80 buttons?
 
Maybe you could use a single 2D array of buttons and then just check in the code which element has a changed value.
 
Can you attach a simple code draft?
0 Kudos
Message 2 of 5
(3,388 Views)


 


@Mountain_jr wrote:
Hello ,
 
I want to know which button is pressed on my "Tab control"
 
For example:
 
I have 3 buttons on my front panel and want to use the "event structure" to dectect wich button is pressed.
We don't use the "Value Change" option becaurse we have the added all buttons.
We want do do this with +/- 80 buttons.

Michael,

See the Question in the Title of the post & the Question you have asked. Both are mutually exclusive, not related at all !

Be clear whether you want the answer for Key pressed on Tab or button pressed/clicked on Tab.

Both are seperate events, Key Down & Mouse Down for the Tab control.

You can get which Mouse button is Clicked on the Tab control, by configuring the Mouse Down event for the Tab control.

But Key Down event fot the Tab control wont work (for that matter for any Control), unless & until that particular control has got KeyFocus on it.

To get the KeyDown event for Tab control working properly, you need to set its KeyFocus to True in the Timeout event.

Else even if you dont wish to set the Tab control with its KeyFocus, but still want to configure some KeyDown code working, the all you have to do is to code the in the KeyDown event of the Vi itself. This will take care whenever you press a key.

See the attached VIs to get a clear understanding of what I mean.

- Partha ( CLD until Oct 2027 🙂 )
Message 3 of 5
(3,362 Views)

One way to do this is to register for Value change on all the controls on the tab control page, and then use the control reference in the event structure to determine which was hit.

Using the Register for events node, you can register for all the control value changes at once even!

Here is a simple example that I hope gives you an idea of what I mean

Message 4 of 5
(3,360 Views)

Hello all,

 

Thank you for your quick response.

This is the solution for our application. We are going to implement that one.

 

Thanks,

 

Michael van den Berg

0 Kudos
Message 5 of 5
(3,347 Views)