LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Any way to limit the input format for string control?

Hi there,

  I need a control for the user to input some string with only alphabets and no special characters. Also need to control the number of characters to input. I search it and see someone use Xcontrol to achieve that but I really have no idea how to get that. Any other way to get this function works on string input?

0 Kudos
Message 1 of 12
(6,673 Views)

Set the string to "single line" and "update while typing". Use a filtering key-down event and discardunwanted characters of characters past the max length.

 

(Make sure not to filter edit keys, such as backspace, etc.)

 

(look at my very old example for ideas.)

0 Kudos
Message 2 of 12
(6,657 Views)

@altenbach wrote:

Set the string to "single line" and "update while typing". Use a filtering key-down event and discardunwanted characters of characters past the max length.

 

(Make sure not to filter edit keys, such as backspace, etc.)

 

(look at my very old example for ideas.)


Thanks a lot. But that's works on in run time not in edit mode, right?

0 Kudos
Message 3 of 12
(6,636 Views)

You did not specify edit mode functionality. If you need that, you need to build an x-control.

0 Kudos
Message 4 of 12
(6,627 Views)

@altenbach wrote:

You did not specify edit mode functionality. If you need that, you need to build an x-control.


my bad. It seems that x-control is the only way to achieve that. I don't know how to program x-control, I found two examples online but it seems that we need to create the appearance ourselve. Is it possible to inherit the control for built-in string or slive string and modify the behavior to get that. I want to keep all controls the same appearance.

0 Kudos
Message 5 of 12
(6,619 Views)

You have full control over the appearance of the x-control. I don't understand your concern.

0 Kudos
Message 6 of 12
(6,613 Views)