BrokenArrow Posted December 5, 2007 Report Share Posted December 5, 2007 Hello all, 1) How do you look for a tab constant comming in on a String control? The tab is causing LabVIEW to just "tab" to the next control, which looses focus, and the tab's "not there". I've tried turing off tab navigation on that control, to no avail, it still looses focus when the tab comes in. My work around is to look for the loss of focus (property node) but I was wondering how you'd do the tab search thing. (string comming in is from a data scanner, i've verified (using Word) that there's no other characters besides the tab after the data). 2) Can you turn off tab navigation overall? I can't do that on this panel (user needs to tab through lots of fields) but I was wondering if it's even a possibility. Many thanks, Richard Quote Link to comment
LAVA 1.0 Content Posted December 5, 2007 Report Share Posted December 5, 2007 Will "update while typing" and the "value Change?" event help? When the event fires look for the tab and if present, re-write control with the non-tab version. Ben Quote Link to comment
Yair Posted December 5, 2007 Report Share Posted December 5, 2007 I prefer the Key Down? event. Check to see if the key is a tab (ASCII 9, if memory serves) and if it is, discard the event. Quote Link to comment
BrokenArrow Posted December 5, 2007 Author Report Share Posted December 5, 2007 Both of those are good ideas for firing an event based on a tab being present, but one thing persists, you still can't type a Tab into a string control (set to show '\' Codes Display) and see the Tab (\t) it in the control - LabVIEW will pop out of the control when Tab is hit. Richard Quote Link to comment
BrokenArrow Posted December 5, 2007 Author Report Share Posted December 5, 2007 Both of those are good ideas for firing an event based on a tab being present, but one thing persists, you still can't type a Tab into a string control (set to show '\' Codes Display) and see the Tab (\t) it in the control - LabVIEW will pop out of the control when Tab is hit. Richard Quote Link to comment
orko Posted December 5, 2007 Report Share Posted December 5, 2007 QUOTE(BrokenArrow @ Dec 4 2007, 12:56 PM) Both of those are good ideas for firing an event based on a tab being present, but one thing persists, you still can't type a Tab into a string control (set to show '\' Codes Display) and see the Tab (\t) it in the control - LabVIEW will pop out of the control when Tab is hit.Richard This is odd... I understood (I thought) what Yen was talking about in his post, and went to work putting together a small example. When it was done however, it doesn't work all the time. http://lavag.org/old_files/post-3266-1196805366.vi'>Download File:post-3266-1196805366.vi (LV8.5) Notice that it *kind of* works if you play with it, but then it stops working. Not sure what is causing this behavior yet. Quote Link to comment
orko Posted December 5, 2007 Report Share Posted December 5, 2007 QUOTE(BrokenArrow @ Dec 4 2007, 12:56 PM) Both of those are good ideas for firing an event based on a tab being present, but one thing persists, you still can't type a Tab into a string control (set to show '\' Codes Display) and see the Tab (\t) it in the control - LabVIEW will pop out of the control when Tab is hit.Richard This is odd... I understood (I thought) what Yen was talking about in his post, and went to work putting together a small example. When it was done however, it doesn't work all the time. http://lavag.org/old_files/post-3266-1196805366.vi'>Download File:post-3266-1196805366.vi (LV8.5) Notice that it *kind of* works if you play with it, but then it stops working. Not sure what is causing this behavior yet. Quote Link to comment
JDave Posted December 5, 2007 Report Share Posted December 5, 2007 QUOTE(BrokenArrow @ Dec 4 2007, 12:56 PM) Both of those are good ideas for firing an event based on a tab being present, but one thing persists, you still can't type a Tab into a string control (set to show '\' Codes Display) and see the Tab (\t) it in the control - LabVIEW will pop out of the control when Tab is hit.RichardHave you tried this? Filter the Key Down? event If it is a tab, discard the event If it is a tab, also append the tab character to the end of the string and update the strings value. EDIT: I played around with orko's code a bit. I have no idea why it isn't working. If you click on it, it works. Then you click elsewhere and click on it, and it doesn't work. I think that the SelEnd is counting the \'s, which throws off the indexing. I think part of the problem is that you can't have '\' Codes Display and Update Value while Typing simultaneously. Quote Link to comment
Mellroth Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(orko @ Dec 4 2007, 10:56 PM) This is odd...I understood (I thought) what Yen was talking about in his post, and went to work putting together a small example. When it was done however, it doesn't work all the time. http://lavag.org/old_files/post-3266-1196805366.vi'>Download File:post-3266-1196805366.vi (LV8.5) Notice that it *kind of* works if you play with it, but then it stops working. Not sure what is causing this behavior yet. I think the reason that this does not work is that the Text.Selection.Start (or End) also takes the \ into account. E.g. if the \-code string displayed is string "12\s345" and we try to add a \t at the end, Text.Selection.End returns 7, when it should return 6. Therefore Insert Into Array fails to add the new \t element. /J Quote Link to comment
BrokenArrow Posted December 6, 2007 Author Report Share Posted December 6, 2007 So I guess the fact remains, you can not type a tab into a LabVIEW string control without causing issues. Hence, my #2 question, (and lament) that you can not (?) turn off tabbing. (?) Excellent responses, thank you! Richard Quote Link to comment
Yair Posted December 6, 2007 Report Share Posted December 6, 2007 If you change Orko's VI to have the string update the value while typing (and remove the \ codes display) it works fine except for the case where the tab is at the end of the string. I'm not sure, but this seems like a bug. In any case, here's one (bad) way of how this can be done (8.0). P.S. I didn't actually realize originally that you wanted to keep the tab in the string. I thought you just wanted to get rid of it. Quote Link to comment
LAVA 1.0 Content Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(Yen @ Dec 5 2007, 10:45 AM) ...P.S. ... I thought you just wanted to get rid of it. Ditto that! Ben Quote Link to comment
BrokenArrow Posted December 6, 2007 Author Report Share Posted December 6, 2007 QUOTE(Yen @ Dec 5 2007, 10:45 AM) .....it works fine except for the case where the tab is at the end of the string...... I'm not sure, but this seems like a bug. That's where the Tab is, at the end. The incomming text from a barcode scanner has a Tab at the end. And I agree that it's a bug, or at least an oversight on NI's part that it can't be done. The tangent I was investigating is that you can't type a Tab at the end of a string and have it "stay".My work-around has been to reprogram the barcode scanner to not have a Tab at the end. That's a pain, because I have to ensure the end user also does that, or deliver the scanner as part of the product.RichardQUOTE(Yen @ Dec 5 2007, 10:45 AM) In any case, here's one (bad) way of how this can be done (8.0)..... Bravo Yen! That's excellent. And it's a pity that we'd have to do these tricks to have the Tab "stay" in the control. Seems like we could turn off tabbing so the loss of focus wouldn't happen in the first place.Richard Quote Link to comment
Michael Aivaliotis Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(Yen @ Dec 5 2007, 07:45 AM) In any case, here's one (bad) way of how this can be done (8.0). I'm not sure why you need the queue. It can be done without a queue. Quote Link to comment
JDave Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(BrokenArrow @ Dec 5 2007, 10:22 AM) That's where the Tab is, at the end. The incomming text from a barcode scanner has a Tab at the end. And I agree that it's a bug, or at least an oversight on NI's part that it can't be done. The tangent I was investigating is that you can't type a Tab at the end of a string and have it "stay".My work-around has been to reprogram the barcode scanner to not have a Tab at the end. That's a pain, because I have to ensure the end user also does that, or deliver the scanner as part of the product. The code I included in my previous post works with a tab at the end. Quote Link to comment
Yair Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(Michael_Aivaliotis @ Dec 5 2007, 08:45 PM) I'm not sure why you need the queue. It can be done without a queue. Good point. I probably got it in at some point where I thought that this was behaving wrong. Since it was just a quick example, I didn't review it.QUOTE(JDave @ Dec 5 2007, 09:04 PM) The code I included in my previous post works with a tab at the end. But it adds a \t in the normal display, and that's not a tab. Quote Link to comment
JDave Posted December 6, 2007 Report Share Posted December 6, 2007 QUOTE(Yen @ Dec 5 2007, 11:06 AM) But it adds a \t in the normal display, and that's not a tab. So do a search and replace on the \t. The display shows the \ Codes, which is desirable for the display (and necessary to make it work, apparently). As far as a workaround, it seems the easiest route. 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.