Jump to content

Incomming string has a tab


Recommended Posts

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

Link to comment

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
Have you tried this?
  1. Filter the Key Down? event
  2. If it is a tab, discard the event
  3. 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.

Link to comment

QUOTE(orko @ Dec 4 2007, 10:56 PM)

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

Link to comment

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.

Link to comment

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.

Link to comment
QUOTE(Michael_Aivaliotis @ Dec 5 2007, 08:45 PM)
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.

Link to comment

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.

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.