LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Editing tree control

I am using CVI7.0.

Based on the XMLTree example, I want to develop a simple XML editor
where the user can load up my XML file and edit values of various
elements. Problem is I can not find a way to edit the items in the
second column of the tree control.

Unlike Table control, which has SetTableCellAttribute where I can define
if the cell is HOT or INIDCATOR, the SetTreeCellAttribute only lets me
change the appearance of it. I can not make the tree cell to be
editable. I can make the tree item labels to be editable by using
SetTreeItemAttribute(panel, tree, ATTR_NO_EDIT_LABEL, 0); but I don't
want to change original tree item labels, only items in second columns.

Any help is very much appreciated.


vishi
0 Kudos
Message 1 of 6
(4,691 Views)
The Tree control in CVI is meant to provide all the functionality of tree controls as they are used in Windows. The additional columns of information in the tree controls are not editable at runtime, as is typical for the uses of tree controls in Windows. What I would recommend is that for your UI, you use a combination of a tree control with a table control, putting the column information in the table control. You would need to respond to the EXPAND and COLLAPSE events on the tree control to adjust the data in the table. You could also respond to the VSCROLL event on the tree, to keep scroll the tabel to keep it lined up with the tree items. I'll make sure our CVI development team knows of your desired use case for the tree control though to consider addi
ng the functionality.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 6
(4,691 Views)
Here is an example to show how you can use a string control to edit tree cell values. When you double click the cell, a string control appears over the cell so you can edit the cell value. When you're done editing, the value of the tree cell is updated to be the value of the string control and the string control disappears.

- jared
0 Kudos
Message 3 of 6
(4,694 Views)
Thanks Chris.

vishi

Chris Matthews wrote:
> The Tree control in CVI is meant to provide all the functionality of
> tree controls as they are used in Windows. The additional columns of
> information in the tree controls are not editable at runtime, as is
> typical for the uses of tree controls in Windows. What I would
> recommend is that for your UI, you use a combination of a tree control
> with a table control, putting the column information in the table
> control. You would need to respond to the EXPAND and COLLAPSE events
> on the tree control to adjust the data in the table. You could also
> respond to the VSCROLL event on the tree, to keep scroll the tabel to
> keep it lined up with the tree items. I'll make sure our CVI
> development team knows
of your desired use case for the tree control
> though to consider adding the functionality.
>
> Best Regards,
>
> Chris Matthews
> National Instruments
0 Kudos
Message 4 of 6
(4,691 Views)
Thanks Jared for your example, that's what I was thinking of doing if
there was no other way. Used to do something like this in VB days.

jared wrote:
> Here is an example to show how you can use a string control to edit
> tree cell values. When you double click the cell, a string control
> appears over the cell so you can edit the cell value. When you're done
> editing, the value of the tree cell is updated to be the value of the
> string control and the string control disappears.
>
> - jared
0 Kudos
Message 5 of 6
(4,691 Views)
Hi jared,
 
I want to edit the cells of a tree control in LabVIEW in the same way as you did it in CVI. It will be helpful for me if you provide me the code in LabVIEW or atleast give an idea to do that.
Thanks,
Ramkumar.D
QuEST, INDIA.
0 Kudos
Message 6 of 6
(4,470 Views)