LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tree: How to show full string in column

Hello,

 

how can i change a cell in a tree to show all text if the text inside is longer than the visible part?

So that the hight of the cell automatically increases and text is shown in two lines.

 

Thanks

0 Kudos
Message 1 of 5
(1,239 Views)

@OnlyOne wrote:

how can i change a cell in a tree to show all text if the text inside is longer than the visible part?

So that the hight of the cell automatically increases and text is shown in two lines.


Not easily...

 

You'd have to get the font and font size (probably application font), and then use picture control tools (Get Text Rect.vi) with the same font and size to examine the text size and then insert line feeds at appropriate places, taking into account the column width.

 

Alternatively, you can make a sub VI with a control or indicator with the same width as the column, insert the text, and use the Get Nth Line method to get the places where line feeds should go...

 

Then insert the adjusted (multi line) text into the tree.

 

Once the text is multiple lines, the row height will adapt automatically (iff Autosize Row Height is on, but it is by default).

 

Of course, if the user can change the column width, you have to repeat this all. Sadly, there's no event for that...

0 Kudos
Message 2 of 5
(1,208 Views)

Thank you. This is a good workaround with the newLines.

 

Another question: How can i delete a selected item in the tree?

If VI is not running then a rightclick on a row shows "delete item". How can this be done while the VI is running?

Thx

0 Kudos
Message 3 of 5
(1,183 Views)

raphschru_0-1662990347153.png

 

Message 4 of 5
(1,174 Views)

@raphschru wrote:

raphschru_0-1662990347153.png


Use an event structure to catch the menu selection event.

 

Then, invoke the Delete Item method.

 

0 Kudos
Message 5 of 5
(1,167 Views)