LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

set cursor in string array

Hi

I would like to know how to change the location of the cursor in a string array.

I am using a bar code reader. I used Key Focus so that my 2D array will be selected. However, what I want to do is to input the 1st bar code from my bar code reader in (row 0, column 0) and press enter. The 2nd bar code read will be in (row 1, column 0) and so on. I do not want to use keyboard at all (except for the Enter after each bar code).

This will mean that I want to programmatically select the 1st element in the array and have the cursor there. After the bar code is read and I press Enter, the cursor will go to the next element and wait for the input from the bar code reader.

I hope I am clear on my requirement.

Regards
Lee

 

0 Kudos
Message 1 of 12
(4,640 Views)

Hi Lee,

What you are attempting to do is actually a bit tricky; I would recommend that you look at the following forum post for some suggestions. In particular, I believe the GenEventProg[2].vi file attached to this forum post should answer your questions.

http://forums.ni.com/ni/board/message?board.id=170&message.id=70107&requireLogin=False

I hope this helps! Please let me know if you need any additional information and I would be glad to help.
 
Regards,
 
Casey Weltzin
Applications Engineer
National Instruments
0 Kudos
Message 2 of 12
(4,599 Views)
Hi Casey,
 
Thanks for your reply. However, that vi does not work all the time and it is using DLLs. I do not have the information of the DLLs so I do not know how it works and how I can modify it to make it work as I want. So I do not find that very useful.
 
Is there any other suggestion or recommendation that you can provide?? Anything, even example vis with proper documentations also can.
 
Thank you & Regards
Lee
0 Kudos
Message 3 of 12
(4,591 Views)
What kind of Barcode scanner are you using, a keyboard wedge (a very bad idea) or an RS232/USB scanner (a very good idea).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 12
(4,590 Views)

Hi Mike,

Its a USB one. (Its this model => http://www.it3800.com/default.asp)

Its the programming part that I am unable to get it right. I have no problem using this USB bar code reader with a string control. But now I want to use it in an array.

Could you help me?? Give me some light Smiley Very Happy

Regards
Lee Ping

0 Kudos
Message 5 of 12
(4,588 Views)
If you have a USB scanner, you're golden. Just grab the barcode from the scanner, insert it into the desired element of the data array and then update the front panel indicator to display the new contents of the array. The cursor doesn't need to even be involved.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 6 of 12
(4,585 Views)

Hi Mike,

Do you mean that I only need to have a 2D array on my front panel and use my bar code to scan, that's all?? This does not work.

I have tried initialising a 2D array to empty string and have my 2D array inside a While Loop. However, when I run this vi, the 2D array got initalised but when I use my bar code reader to scan, the array does not get updated. I do not want to use my mouse to click on which element in the array to store the bar code that is being read. I will it to update one by one from left top down to right top down. The only external key to press will be Enter on the keyboard when the user have got the bar code in one of the element in the array and moved on to the next element in the array.

If I used your method, I need to use my mouse and click on one of the element until I see | in the element then I can use my bar code reader to scan and that element will get updated with the bar code being read. Correct me if I am wrong

Thank you & Regards
Lee

0 Kudos
Message 7 of 12
(4,582 Views)
One thing to be aware of is that the way the replace array element function works, it can't replace the value of an array element that doesn't exist - it won't automatically increase the size of the array to include the element you called out. Attached is an example. Each time you type press the "new barcode" button (to simulate the scanning process) a random number is placed in the on-screen table (which is really just a 2D array of strings).

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 12
(4,576 Views)

Hi Mike,

Thank you so so much. I finally got it to work. I did not include the highlighting part. I did change some of the properties of the controls on the front panel (eg. Input string control, OK button).

Thank alot. You are the man. Smiley Wink

Thank you & Regards
Lee

0 Kudos
Message 9 of 12
(4,566 Views)
Can anybody please repost Mike's or Lee's VI saved for LV 7.1 ?
- Partha ( CLD until Oct 2027 🙂 )
Message 10 of 12
(4,562 Views)