From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Button permanently in keyboard focus

Solved!
Go to solution

Hi all,

 

just as I thought I've seen it all, this happens.

 

I built a user interface with some setup information as well as a button to connect/disconnect.

After that the user can enter command in a line. The line is a system string control set up for single line and also update while typing to trigger a value change event.

 

Here's my problem: When I hit enter, the keyboard focuses on the Connect/Disconnect button and disconnects my application.

 

What I've tried:

  • reordering the tabbing order
  • adding a key down event
  • clicking on other buttons before writing in the string

The behavior I want is:

Enter text in string, press enter --> trigger string value change event

not focus on and press connect/disconnect button

ideally, keep focus on string, so the next command can be entered.

 

VI is attached it's written in 2012.0 f1.

I am grateful for all pointers and moral support in these trying times...



Remember Cunningham's Law
0 Kudos
Message 1 of 5
(2,500 Views)
Solution
Accepted by topic author PeterFoerster

Sounds like your button is bound to <Return>.  Right-click on the control, select Properties, go to the Key Navigation tab, and remove the binding.

Message 2 of 5
(2,486 Views)

@Mancho00 wrote:

Sounds like your button is bound to <Return>.  Right-click on the control, select Properties, go to the Key Navigation tab, and remove the binding.


And also consider using a property node >>> FocusKeyBind to ...

 

When you get a "Command Key down" event and the character is NOT a Enter, set the FocusKeyBind for the command control.

 

When the key is an enter set the FocusKeyBind to the Boolean.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 5
(2,480 Views)

Oh for crying out loud! It was right there...

Thank you for your quick response!

 

I removed the key binding and on enter, I set the KeyFocus to true.



Remember Cunningham's Law
0 Kudos
Message 4 of 5
(2,454 Views)

@PeterFoerster wrote:

Oh for crying out loud! It was right there...

Thank you for your quick response!

 

I removed the key binding and on enter, I set the KeyFocus to true.


It happens to all of us.

 

See here for an example of when I was brain dead.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(2,439 Views)