LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Truncate text

Solved!
Go to solution

Hi Everyone,

 

I'm trying to truncate a text control value with "..." at the end, whenever the value it holds is longer than the control can display.

 

Does anyone has an idea about how this can be done ?

 

I'm trying but not getting a simple way through properties and methods.

Unless I fix the text control width and its police. But for me, that mean anytime I would like to do anything similar, I'll have to repeat the process of counting how many characters the text control can hold.

 

 

Great Thanks to everyone.

0 Kudos
Message 1 of 6
(3,251 Views)

You should be interested in this idea over on the Idea Exchange:Some indication that a string control isn't showing the entire string.  Go ahead an give it a kudo.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(3,242 Views)

Thanks Crossrulz...

 

0 Kudos
Message 3 of 6
(3,230 Views)

I was thinking of something like this:

 

Example_VI.png

 

The problem I get is that the Width property seems to include the decorations and the other properties (TotalRectangle and MasterRectangle) require scripting and just got me confused.  It might work to use a constant to account for the width of the control, but that doesn't lend itself to reuse.  This uses an ellipsis in the control's caption and decides whether to show it based on the contents of the control.

 

Example_VI.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 4 of 6
(3,222 Views)

@El-MDA wrote:

Hi Everyone,

 

I'm trying to truncate a text control value with "..." [...]


You're not looking to truncate, I think you're looking to append.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 6
(3,220 Views)
Solution
Accepted by topic author El-MDA

I use the following to estimate the maximum number of characters a display can contain and then process the string accordingly.

 

Estimate max characters.png



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 6 of 6
(3,198 Views)