LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically set "Max Entry Length" for a tree cell

Solved!
Go to solution

I want to specify a N_MAX maximum length for the cell names of a tree, so that when the user press F2 key to rename it, he's not allowed to enter more than N_MAX characters.

 

For the items already existent in the uir file, I'm able to get this behaviour setting Edit Tree >> Edit Columns/Cells >>Edit Cell >> Max Entry Length to 5 (see attached img03.png).

When the user tries to rename this item, he's not allowed to enter more than 5 characters (see attached img02.png).

 

But how can I set this attribute for the items programmatically added (for example through InsertTreeItem( )).

I haven't been able to find the right attribute, because the cell attribute ATTR_LABEL_TEXT_LENGTH (that seems more or less what I'm looking for) is "not settable"

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 3
(3,158 Views)

I suppose there is no way other then preprocess the item name and issue InsertTreeItem only if correct, passing the correct label to it.

You could for example have a small panel for the user to insert the name fro the new cell, with a string control limited to 5 characters or something like this.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,150 Views)
Solution
Accepted by vix

You found an omission in the documentation. You can use ATTR_MAX_ENTRY_LENGTH and ATTR_MAX_ENTRY_CHARS with SetTreeCellAttribute and SetTreeItemAttribute to set the max entry for a tree cell.

 

Thanks for reporting this and sorry for the inconvenience.

Message 3 of 3
(3,135 Views)