LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
ciaoa

Copying Tree Items

Status: New

When I use the function "CopyTreeItem", the item is copied, but the value (behind the item is automatically increased or changed). Because the item might be used several times and the item is identified by its value, it is necessary, that the value behind the item is NOT changed. Please don't change the value of the item, when it is copied or please add a parameter, which handles the changing of the value (e.g VAL_DONT_CHANGE, VAL_LAST etc.).

5 Comments
LuisG
NI Employee (retired)

If I'm understanding you chorrectly, the current behavior as you're describing it would actually be a bug. The value of the item should not be changing when you copy it to another tree.

 

I tried to reproduce this behavior but wasn't able to: I created two empty trees, inserted an item in one of them, and then copied it to another tree. Afterwards, the value remains the same (100) in both items:

 

InsertTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, 0, VAL_NEXT, "item", "", 0, 100);
CopyTreeItem (panelHandle, PANEL_TREE, 0, panelHandle, PANEL_TREE_2, VAL_CHILD, 0, VAL_NEXT);
GetValueFromIndex (panelHandle, PANEL_TREE, 0, &val1);
GetValueFromIndex (panelHandle, PANEL_TREE_2, 0, &val2);

 

If I'm doing this differently from you, can you help me reproduce the behavior you're seeing?

 

Luis

ciaoa
Member

Hi Luis,

 

I was copying the item into the same tree to a different position. This seems to cause a changing of the tree items value.

 

Best regards

 

ciaoa

LuisG
NI Employee (retired)

Okay, I tried copying it to the same tree, but I still can't reproduce it. This is what I'm now doing:

 

InsertTreeItem (panelHandle, PANEL_TREE, VAL_CHILD, 0, VAL_NEXT, "item", "", 0, 100);
CopyTreeItem (panelHandle, PANEL_TREE, 0, panelHandle, PANEL_TREE, VAL_SIBLING, 0, VAL_NEXT);
GetValueFromIndex (panelHandle, PANEL_TREE, 0, &val1);
GetValueFromIndex (panelHandle, PANEL_TREE, 1, &val2);

 

...val1 and val2 still equal 100.

 

How was your copy different?

 

 

ciaoa
Member

Thnaks for your quick reply.

 

I'm doing it with the same way.

 

So far I remember, sometimes the value is changed and sometimes not. Pehaps it depends on if I copy just one item (without childs) or if I copy an item with childs. The values of the childs are sometimes changed...

 

Background info:

I was programming a profile editor (GUI) for programming a profile with HW and SW specific actions. Any parent item (its value isn't relevant) defines any profile step description and its duration after performing all internal actions (= child items). Each pre defined action is recognized by its value to know, which action has to be performed. After copying the parent item to another position in the tree causes, that its child items (actions) are interpreted with wrong actions, because their value were changed.

Workaround: I was creating a tree column, in which the dedicated action item value is written instead using the item value.

 

I'm using CVI 2010 without SP1, because SP1 is a little bit buggy. (e.g. UI editor: property list is not filled. Defining DLL functions with "FARPROC functionName" without defining parameters for dynamically loading and calling this function causes the error message, that prototype of the function is not defined, although the dedicated option ("require prototypes") in "editor options" dialog is deactivated. etc.)

 

LuisG
NI Employee (retired)

Well, the behavior that you're describing (the changed values in the copied items) sound like a bug. This is not just a case of a missing feature. Therefore, you might get better help if you re-post this as a bug in the main forum, rather than here in the Idea Exchange. (You'll probably get asked to provide some version of your program that reproduces the problem).

 

Concerning the other two SP1 issues that you're describing, I know about the second issue, but I don't know about the first. Have you reported it before? It doesn't sound like a known issues to me, but I might have missed it.

 

Luis