spaghetti_developer Posted March 21, 2012 Report Share Posted March 21, 2012 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. Quote Link to comment
jgcode Posted March 21, 2012 Report Share Posted March 21, 2012 You'll have either have to use a system control or vote here and patiently wait Quote Link to comment
hooovahh Posted March 21, 2012 Report Share Posted March 21, 2012 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 Quote Link to comment
jgcode Posted March 21, 2012 Report Share Posted March 21, 2012 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. Quote Link to comment
Darren Posted March 21, 2012 Report Share Posted March 21, 2012 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! 1 Quote Link to comment
crelf Posted March 21, 2012 Report Share Posted March 21, 2012 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! Quote Link to comment
spaghetti_developer Posted March 22, 2012 Author Report Share Posted March 22, 2012 Both work properly, but I'd rather use the first solution, I like it more. I just want to point out that you have to care to have enable the property "update value while typing" of both the controls to be sure that the Value Change event is fired at every changes! Quote Link to comment
hooovahh Posted March 22, 2012 Report Share Posted March 22, 2012 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. Quote Link to comment
crelf Posted March 22, 2012 Report Share Posted March 22, 2012 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. Quote Link to comment
drjdpowell Posted March 22, 2012 Report Share Posted March 22, 2012 Or one could just learn to love the black rectangle. Problem solved. Quote Link to comment
Darin Posted March 22, 2012 Report Share Posted March 22, 2012 Or, as I suggested in the Idea Exchange, simply color your Front Panel black. 1 Quote Link to comment
asbo Posted March 22, 2012 Report Share Posted March 22, 2012 Or, as I suggested in the Idea Exchange, simply color your Front Panel black. Good lord, think of the energy savings... Quote Link to comment
Jeffrey Habets Posted March 22, 2012 Report Share Posted March 22, 2012 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! Quote Link to comment
hooovahh Posted March 26, 2012 Report Share Posted March 26, 2012 Absolutely! And it got a whole lot better since the introduction of splitter bars! Now if only you could hide it at runtime, or make it 0 pixels in size. Quote Link to comment
Jeffrey Habets Posted March 26, 2012 Report Share Posted March 26, 2012 Now if only you could hide it at runtime, or make it 0 pixels in size. Absolutely! I'd kudo it, but I already did when the Idea was submitted a long time ago. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.