Jump to content

How to remuve the black rectangle on Key focus


Recommended Posts

Hi guys,

I'm here again. I have a dialog to ask the user to insert the SN of the Device under test. I set the property "Key focus" of the String control where the user has to insert the SN, on "true" to be sure that at start up of the dialog the key focus is set to the SN string control and to be able to catch the key press of the user but, when I enable this property of the control a black rectangle appears around the control and I would like it doesn't appear. How can I avoid that that rectangle appears?

Thank you in advance.

Link to comment

So with most LabVIEW UI issues there is a work around. This work around only works for strings controls unfortunately. Hide the real string control off screen that has focus, then have it use the event for change value updating the string control on screen. Attached is an example in 2009 that does this. The key is to enable "Update Value When Typing" on the string with focus so that an event is fired after every key press.

Keyfocus Without Border.vi

Link to comment

So with most LabVIEW UI issues there is a work around. This work around only works for strings controls unfortunately. Hide the real string control off screen that has focus, then have it use the event for change value updating the string control on screen. Attached is an example in 2009 that does this. The key is to enable "Update Value When Typing" on the string with focus so that an event is fired after every key press.

Nice!

Another issue I can see with this is that you don't have a visual indication that the string has focus e.g. no | in the control.

Also you can still tab in this example and get the black rectangle of course, this could be easily fixed by skipping this control during tabbing.

Link to comment

I had this issue in the Quick Drop window. And for reasons I can't remember now, I wasn't able to use a system combo box. So my solution was to have a frame decoration, with the same color as the panel, that I position exactly where that ugly black box would be. And the decoration is higher up in the panel order than the combo box. So when I assign key focus to the combo box, you don't see the ugly black border because the panel-colored decoration is above it. I also have to resize this decoration on a panel size, to ensure it's always surrounding the combo box at exactly the right size.

Programming UIs in LabVIEW is fun!

  • Like 1
Link to comment
Hide the real string control off screen that has focus, then have it use the event for change value updating the string control on screen.

You disgust me.

...my solution was to have a frame decoration, with the same color as the panel, that I position exactly where that ugly black box would be. And the decoration is higher up in the panel order than the combo box.

See, now, I like that!

Link to comment

You disgust me.

Both work properly, but I'd rather use the first solution,

Well my methods may be disgusting but at least spaghetti_developer agrees with my methods...on second thought I'm not sure how I feel about that.

In all honesty my method probably has more maintenance, and is probably less obvious to another developer, but choose which you prefer.

Link to comment

I also have to resize this decoration on a panel size, to ensure it's always surrounding the combo box at exactly the right size.

This can actually be achieved without doing any coding in the panel size event. Just need to have the correct correct combination and usage of a splitter bar, grouping (the combo-box and decoration) and 'Scale object with pane' and you can mimic the behaviour QD window without coding. Set pane sizing for all panes to 'Scale objects while sizing' and it even gets better! :)

Programming UIs in LabVIEW is fun!

Absolutely! And it got a whole lot better since the introduction of splitter bars!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.