09-12-2022 03:15 AM
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
09-12-2022 05:13 AM - edited 09-12-2022 05:15 AM
@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...
09-12-2022 07:19 AM
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
09-12-2022 08:46 AM
09-12-2022 09:00 AM
@raphschru wrote:
Use an event structure to catch the menu selection event.
Then, invoke the Delete Item method.