LabVIEW

cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 

How limit input string control?

I am trying to set string length limit that user can input to 205 and want the string control not to display any character after the 205th character. I do not want to use the Event structure and I am use the Labview 7.1
Any suggestion?
0 Kudos
Message 1 of 18
(10,572 Views)

And you don't want to use the event structure because?...

 

Alternative: Use a loop. Poll the string length in the loop. If >205, chop off the extra characters and write back to the string control. Make sure the string's "Update value while typing" is set. Sloppy, but it works. Without an event structure. 

0 Kudos
Message 2 of 18
(10,565 Views)

WSalas wrote:
I do not want to use the Event structure

Why not? This sounds like the perfect application for an event structure.


Message Edited by Cory K on 01-10-2009 10:57 AM
Cory K
0 Kudos
Message 3 of 18
(10,531 Views)

Hi Cory,

 

instead of Text.Text property you can use the "Value" property too - one menu less and IMHO more intuitive Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 18
(10,514 Views)

GerdW wrote:

Hi Cory,

 

instead of Text.Text property you can use the "Value" property too - one menu less and IMHO more intuitive Smiley Wink


 

Hehe, yeh. Whatever saves a click or two :smileyvery-happy:.
Cory K
0 Kudos
Message 5 of 18
(10,510 Views)

Cory and GerdW,

 

if you need to save clicks, use a local variable and forget about the case structure. šŸ˜„ šŸ˜„

Message EditƩ par chilly charly le 01-11-2009 04:05 AM
Chilly Charly    (aka CC)
Message 6 of 18
(10,495 Views)

chilly charly wrote:

use a local variable



People on the forums tend to get mad when local variables are used.
So for the sake of not getting yelled at, we'll stick with the case structure :smileyvery-happy:

 

Cory K
0 Kudos
Message 7 of 18
(10,479 Views)

Cory K wrote:

chilly charly wrote:

use a local variable



People on the forums tend to get mad when local variables are used.

No, people on the forums tend to get mad when local variables are abused. Big difference. Smiley Wink

Message 8 of 18
(10,459 Views)

Cory K wrote:

chilly charly wrote:

use a local variable



People on the forums tend to get mad when local variables are used.
So for the sake of not getting yelled at, we'll stick with the case structure :smileyvery-happy:

 


But in your code, you are essentially using a local variable.  Actually, it's a bit worse, it's a property node and a little bit more obscure one that.

 

If you are trying to change a value that is part of a control (an object that is a source of data in a block diagram) you have to use either a local variable or a property node to be able to update/correct it.

 

The use of the case structure has nothing to do with the use of the property node or local variable.

Message Edited by Ravens Fan on 01-11-2009 11:24 AM
Message 9 of 18
(10,455 Views)

Instead of trimming the oversized string after the fact, simply use a filtering event and discard key entries if the size is already met. Make sure to still allow editing keys to function.

 

This problem has been discussed last summer, so modify my example  from back then. All you need to do is change one diagram constant. šŸ˜‰


Message 10 of 18
(10,434 Views)