UI Interest Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

X Control - String Limit

Overview

This XControl is useful for limiting the number of characters a user can type into a string control. You can download and drop this control into any LabVIEW program.

Description

This XControl uses code written in a two sub-vis to limit the number of characters that can be entered into the control.  The number of characters can be changed at run-time through the "String Length" property.  This XControl also comes with three other properties: BG Color, Text Color, and Font. Included is an example of how the XControl may be used.


Steps to Implement or Execute Code

To run the example VI:

   1. Download the attached zip file, extract files and open "String Limit.lvproj"

   2.  Open "String Limit Example.vi"

   3. Type in the string box; notice the limit is originally set to 10.

   4.  To reset the string limit, set the value of the control, then click the "Run" button.

   5. Click the large "Stop" button; notice the string control maximum length is now set to your value.


To use in your code:

   1. Add the XControl to your project

       a.  In the project, right-click "My Computer"

       b.  Select "Add -> File"

       c.  Navigate to where you have saved the XControl and double-click it

   2. Drag the XControl from your project explorer onto your front panel

   3. You will need to initialize the "String Length" property of the XControl in your code via property node.

   4. Enjoy!


Requirements

Software

LabVIEW 2009 or later. LabVIEW 2012 version also included.


Hardware

N/A

If any suggetion / Query Please let me know

Regards

Prabhakant Patil

String Limit.PNG

Regards
Prabhakant Patil
Comments
Prabhakant_Patil
Member
Member
on

Please Give me suggestions to improve this control

Regards
Prabhakant Patil
tusharjambhekar
Member
Member
on

Good Example.

Just because you are asking the suggestions these can be few improvements

  1. if you type to the full length, then select some part of text and then try to replace it with typing new character then xcontrol does not accept it. actually it should.
  2. in edit mode xcontrol looses lot many items in context menu which are specific to string control(e.g. \ codes display etc.)
  3. Also many properties related to String control are missing (e.g. DispStyle)
  4. some kind of visual indication that you have reached max limit can be good(e.g. change in bg color)
Contributors