LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Limiting Input String Length

I'm reviving the thread because I find it adequate to the problem i had - how to limit character length in string control and because the suggested solutions to the problem were using event structure which I was trying to avoid. The code was tested on LV2012. Run the vi input the desired maximum string length in to the MaxLength control delete the current STRING string from TextBox control then type some text in TextBox control. Observe that the TextBox control does not accept more than MaxLength characters.

 

Best regards

 

0 Kudos
Message 21 of 32
(2,115 Views)

@altenbach

No reason at all. I should've thrown a delay in a loop.

0 Kudos
Message 22 of 32
(2,098 Views)
Why do you think the property node should be in a loop at all? Typically they don't change once set.
0 Kudos
Message 23 of 32
(2,083 Views)

Reviving the old thread AGAIN as this seems the most pertinent place to post this addition

 

If wanting to limit input string length on one input it is possible there are a number of other string inputs on the same screen. Setting intelligent tabbing order between the controls makes the operation a little more slick. I found that if the input is full (to the prescribed string limit) then tab does not execute. The image attached shows one way of getting around this. Setting a key focus for the Tab key character code overrides the discard switch that appears to be getting 'stuck'.

 

There is a further improvement required that hopefully someone can contribute to, the key focus property only works if the next control is enabled. My question is;

 

Is there a method to select the next enabled control in the tabbing order rather than selecting or choosing a specific key focus?

 

 

 

0 Kudos
Message 24 of 32
(1,884 Views)

Hi,

I think that my solution below should solve the problem with the tab key. It just adds a check to see if the tab key is pressed and then does not discard it so that it acts as it normally should.

I hope this helps.

-Michael

string limit tab fix v2.PNG

Message 25 of 32
(1,863 Views)

That works, thank you!

 

Kind Regards,

 

Michael

 

 

0 Kudos
Message 26 of 32
(1,845 Views)

My Eurotherm 2604 displays actual temperature reading partially but the other loop(for humidity) is okay. What could be the problem?

0 Kudos
Message 27 of 32
(1,752 Views)

Hi,

To get the best help, I would suggest you start a new post and thread.

Thanks,

Parul M.

Applications Engineer

National Instruments

Message 28 of 32
(1,741 Views)

In this example for false case u should not able to enter the character to the string so what logic i need to use here.

Please help in this

0 Kudos
Message 29 of 32
(1,421 Views)

Hi, 

I need to limit the input string length, but without using the Event structure Function.

Please help me out with this solution.

0 Kudos
Message 30 of 32
(1,416 Views)