Tree controls has me stumped!
I'm pretty new with tree controls so please bare with me. I'm trying to create a tree using an array. Each coloum represents a parent and the last coloum is the child. There are a number of entries that have the same parent. When I run my vi, it creates a new parent with the same name. I want to add the enty to the exsisting parrent. See the attached vi. Hope someone can help!
Solved!
Go to Solution.
Attachments:
Tree Properties.vi 23 KB
Try the attached vi, I think it's what you were trying to accomplish. The problem you were having was becuase you were adding items that already existed in the tree, so labview forces their item tags to <Item>_1, <Item>_2, etc. In the attached vi you'll see I check if the current item already exists, if it does, I don't add it. I also build the child tags as <col1>_<col2>_<col3>_... for each row so that I can check if the same element already exists. Hope this is what you were looking for!
-RW
Attachments:
Tree Properties (Mod).vi 25 KB
Similar Messages
-
Tree Control - Design Mode - Indent Level
Hi!
In edit mode tree control has indent / outdent level right - click menu. I need this functionality. Indenting and outdenting items. I've implemented, but the in/out Denting does not works well, it the tag has children.
I am wondering, is it possible to call indent/outdent level right-click menu in run mode?
+++ In God we believe, in Trance we Trust +++
[Hungary]Interesting challenge! The key involves creating your own custom run-time menu items and defining the actions of those items. Consider the following code, attached as an image and LV2010 VI:
a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}
Attachments:
TreeIndentOutdent.vi 17 KB -
I created a tree control and am trying to follow the Help on how to indent, but when I select an item, say "Signal Generator" and right-click, the "Indent Item" option is greyed out. Is there something else I need to do?
Attachments:
Tree of Tests.vi 6 KBHello mrbean,
Your tree control has the row headers set to visible. These headers are just a type of label not the actual data inside the control. Since it is not the actual data they cannot be indented. Try putting the actual data values beside the row headers and notice that you can select items and right click to see that indent is no longer greyed out.
Steven T. -
SAP GUI hangs up - tree control
Hi,
I have written an ABAP program to display a report in tree format. This tree(designed using SAPGUI tree control) has close to 75K nodes. When I exit from this application(report), the SAPGUI hangs up. It takes about 25-30 minutes to exit this report program.
Further analysis tells me that it is only the front end process and NOT the runtime of the program. I am using Windows.
I am not sure how much this forum is relevant to this problem. But, any inputs on the reason for a slow performing GUI is appreciated.
Thanks,
HemaThere are some known performance issues with older patchlevels, since you neither mention, what GUI version you use and which patchlevel I would just recommend updating to 7.20 and the latest patchlevel and try again.
If that doesn't help the only thing left is to decrease the amount of data being sent to the frontend.
Markus -
Hi everybody,
I am getting a display problem with tree control. The tree
control has a fixed height and width, and has quite a few nodes
with different level of branches. When i have the tree fully
expanded, then I am getting both horizontal and vertical scrolls.
If I scroll down using vertical scrollbar and scroll right using
horizontal scrollbar, I am able to see the tree node labels
properly. But after that if I scroll up then the nodes that had got
hidden due to the previous down scroll appear cut off.. the label
is half way erased.Hi everybody,
I am getting a display problem with tree control. The tree
control has a fixed height and width, and has quite a few nodes
with different level of branches. When i have the tree fully
expanded, then I am getting both horizontal and vertical scrolls.
If I scroll down using vertical scrollbar and scroll right using
horizontal scrollbar, I am able to see the tree node labels
properly. But after that if I scroll up then the nodes that had got
hidden due to the previous down scroll appear cut off.. the label
is half way erased. -
Hi All,
I have a need for a tree control which supports having a
combobox. I've done extensive research on Google, but came up
empty. If anyone has or can point me to any examples, it would be
greatly appreciated.
Thanks in advance!
-jfHere's a follow-up to my first question.
I found an example of a tree with checkboxes and set out to
modify it so that it would fit my needs. I'm really stumped here,
because it will render a checkbox or radio button fine, but I can't
get it to render a combobox or button. I'd also like the combobox
and button to be on the right side of the parent/child label, is
that possible?
Any help anyone can provide is greatly appreciated.
Content of ComboBoxTreeRenderer:
package util
import mx.controls.Image;
import mx.controls.Tree;
import mx.controls.treeClasses.*;
import mx.collections.*;
import mx.controls.ComboBox;
import mx.controls.Button;
import mx.controls.RadioButton;
import mx.controls.listClasses.*;
import flash.events.Event;
import flash.events.MouseEvent;
import mx.events.FlexEvent;
import flash.display.DisplayObject;
import flash.events.MouseEvent;
import flash.xml.*;
import mx.core.IDataRenderer;
public class ComboBoxTreeRenderer extends TreeItemRenderer
protected var myImage:Image;
// set image properties
protected var myComboBox:ComboBox;
protected var myRadioButton:RadioButton;
protected var myButton:Button;
public function ComboBoxTreeRenderer ()
super();
mouseEnabled = false;
override protected function createChildren():void
super.createChildren();
myRadioButton = new RadioButton();
addChild(myRadioButton);
myComboBox = new ComboBox();
addChild(myComboBox);
myButton = new Button();
myButton.setStyle( "label", "Button" );
addChild(myButton);
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data)
if (super.icon != null)
myRadioButton.x = super.icon.x;
myRadioButton.y = 2;
super.icon.x = myRadioButton.x + myRadioButton.width + 17;
super.label.x = super.icon.x + super.icon.width + 3;
else
myRadioButton.x = super.label.x;
myRadioButton.y = 2;
super.label.x = myRadioButton.x + myRadioButton.width + 17;
Content of comboBoxTree_test.mxml:
<?xml version="1.0" encoding="iso-8859-1"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
creationComplete="init();" >
<mx:Script>
<![CDATA[
import mx.collections.*;
[Bindable]
public var treeList:XMLList =
<>
<folder isBranch="true" label="Branch 1" >
<folder isBranch="false" label="Leaf 1" />
<folder isBranch="false" label="Leaf 2" />
</folder>
</>;
[Bindable]
public var folderCollection:XMLListCollection;
private function init() : void
folderCollection = new XMLListCollection(treeList);
comboBoxTree.dataProvider = folderCollection;
]]>
</mx:Script>
<mx:Tree
id="comboBoxTree"
itemRenderer="util.ComboBoxTreeRenderer"
labelField="@label"
width="100%" height="100%" >
</mx:Tree>
</mx:Application>
************************************************************** -
Not able to get the database data into the Tree Control
Hi Everybody,
I have to populate the tree control with nodes and items, which is to be populated from the database, and the tree control is <b>dynamic</b>. I mean, there is a <b>toolbar</b>, whenever a <b>pushbutton is clicked</b>, depending on that the tree contents has to be changed.
If anybody had worked with <b>CL_GUI_COLUMN_TREE</b> control to get the data from database, depending upon the <b>pushbutton selected in Toolbar</b>, please paste the seudocode for it.
Regards,
Abdul,
Intelligroup.
P.S: Helpful answers will be rewarded.have you seen this demo program
SAPCOLUMN_TREE_CONTROL_DEMO
Regards
Raja -
How to get position of a ring in a tree control?
Ok, this is probably a stupid question, but how does one get the position of a ring inside of a tree control? I have a tree with two columns, with rings in the second column. I can set the position using SetTreeCellRingValueFromIndex(), but how does one get the position after the user has modified the control? I found the functions GetTreeCellRingIndexFromValue() and GetTreeCellRingValueFromIndex() but I haven't found a way to get either the Index or the Value of the ring (what I'm looking for is the index, but if I can obtain the value I can go from there). Thanks in advance!
Solved!
Go to Solution.Hi,
You can use GetTableCellVal function to get the value of the ring.
There is not special "ring" function for that. Maybe that's what you were searching for
From the value you can get to the index using the functions you are already aware of.
Hope this helps,
S. Eren BALCI
www.aselsan.com.tr -
Tree-control for data input?
Hi,
I need to program an input screen for values that have hierarchical dependencies (e.g. sums). I feel, the most adequate user-interface would be a tree control, because of the data dependencies and also because the users asked for a possibility to collapse/expand parts of the data during input.
I had a look at CL_GUI_COLUMN_TREE, but I'm not sure, if it can be used for data input. Has anyone done something like this before or can anybody direct me to some additional sample coding? (the sample coding in the reuse library didn't do it...)
Thanks for your help, greetings, Kathrin!Hello Kathrin,
Since you say that the user's input is hierarchical in nature, it is nice to have a tree-control for input. But, the choice of using a custom-control-version of the tree is a cause for some concern. I cannot recollect any of the SAP screens where the input can be given through such a tree framework (please do let me know if you have come across one). The problem with such a tree would be in the areas of even-handling. Filling the tree with appropriate data at the right times would be another challenge.
However, there's one alternative that I would like to direct your attention to. You must have observed another kind of tree, when you select an application component from the APPLICATION HIERARCHY, which is just like a list. Also, the <i>Transport Organizer (SE09)</i>, <i>Menu Painter (SE41)</i> etc., have this kind of a tree. You can use this if you (or rather your users) are very particular on having a tree display. For more information, you can see the Function Group <b>SEUT</b>, which has the required function modules to accomplish the same. The Function Group is well documented, and you might have to work a little on the function modules themselves.
Please do let me know if this is a suitable option to meet your requirement. All the best,
Regards,
Anand Mandalika. -
Items in Tree control move around when data is submitted using custom ItemRenderer
I'm working on a Tree control with an XMLListCollection as
its dataProvider.
The dataProvider has information looking like this :
quote:
<?xml version='1.0' encoding='utf-8'?>
<INFO>
<FIELD label="STR_USER_NAME"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_USER_EMAIL"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_OPTIONAL"
type="branch"
value="0"
>
<FIELD label="STR_USER_ADDRESS"
type="text"
value=""
>
</FIELD>
<FIELD label="STR_USER_POSTAL_CODE"
type="text"
value=""
>
</FIELD>
</FIELD>
</INFO>
So in the Tree control I'd like the information to show up
with a label and
an
editable textbox for each item :
[Label] [textbox]
To do this I made a tree like this :
quote:
<mx:Tree id="userTree"
editable="true"
rendererIsEditor="true"
editorDataField="curVal"
itemRenderer="{new ClassFactory(ItemRendererUser)}"
itemEditEnd="e_ProcessData(event);"
dataDescriptor="{new DataDescriptorUsers()}"
showRoot="false"
verticalScrollPolicy="{ScrollPolicy.AUTO}"
/>
where the e_ProcessData() function looks like this (I used
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/js/html/wwhelp.htm?href=c
elleditor_073_16.html#202105 as a guide) :
quote:
public function e_ProcessData(event:ListEvent):void
event.preventDefault();
userTree.editedItemRenderer.data.@value =
ItemRendererUsers(event.currentTarget.itemEditorInstance).curVal;
userTree.destroyItemEditor();
userTree.dataProvider.notifyItemUpdate(userTree.editedItemRenderer);
} // END OF e_ProcessData()
I attached the rest of the files because they're a little
bit longer.
When I run the program, the data shows up fine when it is
initialized the
very
first time, and I made a test button that just dumps the
contents of the
dataProvider in a trace statement to verify that the data has
been set
properly.
The problem I've run into is whenever the textfield is
edited, the item
that
I've selected jumps around the list.
For example, if I edit the item "STR_USER_NAME" after I
finish the edit, it
will move from the very first position in the Tree to the
bottom of the
Tree.
I traced the contents of the dataProvider and the
dataProvider structure
stays
the same, with the "STR_USER_NAME" at the top, but if I look
at the flex app
in
the web browser, its position is at the bottom of the Tree.
This happens for every other item I try to edit... I read in
the
documentation
that the ItemRenderers are recycled, so it means I should be
checking to
make
sure the initial states are covered, but I'm not sure how
this affects my
application.
Can anyone help me out with this ? Its very confusing - I've
tried making
an
ItemRenderer using pure actionscript, mxml and the
combination you see in
this
example and I always end up with the same behaviour - So I
must be missing
something critical...
// ItemRendererUsers.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml"
verticalScrollPolicy="{ScrollPolicy.OFF}"
horizontalScrollPolicy="{ScrollPolicy.OFF}"
creationComplete="initItemRendererUsers();"
>
From my FAQ:
Q: I've created a custom itemRenderer component to use in a
List
based component (Datagrid, TileList, HorizontalList, etc.).
When my List
first displays, everything looks fine, but when I scroll it
or change the
dataProvider, some of the itemRenderers show values or
formatting that
aren't right. How do I fix this?
A: List-based components don't draw a renderer for every item
in the
dataProvider. Instead, they create enough to display what is
on screen now,
plus one or two more waiting in the wings. This means they
recycle the
renderers rather than creating new ones when you change
dataProvider or
scroll up and down. When you use a creationComplete event to
set up the
itemRenderer, that event doesn't happen again when the
renderer is used for
a different set of data. The solution to this is to override
the set data
protected function that most components have.
For more information, check out the following resources:
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html?devcon=f1
http://blogs.adobe.com/aharui/2007/03/thinking_about_item_renderers_1.html
Please note, I post this FAQ weekly, and you can find a
permanent copy of it
here
http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf"peterh8234" <[email protected]> wrote in
message
news:gaqttd$kft$[email protected]..
> Yes - the set and get functions are listed down below.
But the quirky
> behaviour
> is the same regardless of whether I override the set and
get functions or
> not.
>
> I noticed there was another variable called listData -
should I be using
> that
> one or the data variable to read and write to the
dataProvider ?
>
> // _data
> [Bindable] public var _data:Object;
> [Bindable("dataChange")]
> //
> override public function get data():Object
> {
> trace('[ItemRendererDefault.GET data()] called for {' +
> _data.attribute("label") + '}.');
> return _data;
> } // END OF get data()
>
> //
> override public function set data(value:Object):void
> {
> _data.@value = inputText.text;
> trace('[ItemRendererDefault.SET data()] called for {' +
> _data.attribute("label") + '}.');
>
> invalidateProperties();
> } // END OF set data()
Your set data needs to set a flag that gets picked up in
commitProperties()
and does your thing that you were doing before in
creationComplete. You
should see examples of this in the links I posted. Instead of
this:
_data.@value = inputText.text;
you should look at implementing IDropInListItemRenderer,
which will allow
you to dynamically determine which field to look at, instead
of hardcoding
it. You also might wind up overwriting the stored value with
a null value
when the List passes the stored value in. I'd encourage you
to really go
through those links I posted and make sure you understand
what they're
saying. The itemRenderer life cycle is one of the hardest
things to
understand, but once you understand it, it makes many things
in Flex much
easier. It's worth investing the time. -
Report with Dynamic tree control
I have a report with a TREE CONTROL.
<p>
A Tree is referenced to: CL_GUI_ALV_TREE_SIMPLE and is located on the left side of the screen.
<p>
See diagram below. The Tree has MULTI-LEVEL nodes and the user can click on any of the nodes which will
trigger a report (rellevant for that node) to appear in the REPORT container.
<p>
Everythign is working fine.
<p>
I now have a requirement to add a TREE ON/OFF functionality. I have added this by 'Freeing' TREE
container and by initializing when the user Turns ON the TREE. It is working fine, HOWEVER, when
it initilizes the TREE it is COLLAPSED and obviously does not point to the NODE that was clicked.
<p>
My goal is to retain the value of the NODE that was pressed and EXPAND the tree to that node and
highlight it... Please note that I have MULTI-LEVEL nodes and the user can double click on NODES
and ITEMS.
<p>
I tried using GET_SELECTED_NODES, but it only works if the user selects the LOWEST level node/item.
<p>
Any advise will be appreciated.
<p>
Also, as an alternative, I was thinking of resizing TREE container to WIDTH of 1 when the user PRESSES
TREE OFF and resizing back to width 200 when the user presses TREE ON. I could not find any methods
that would work with CL_GUI_DOCKING_CONTAINER.
Please help! Thank you in advance.
<br>
<br>
<img src="http://img237.imageshack.us/img237/6684/bdccz3.jpg" border="0"/></a>
<p>
<p>I have a report with a TREE CONTROL.
<p>
A Tree is referenced to: CL_GUI_ALV_TREE_SIMPLE and is located on the left side of the screen.
<p>
See diagram below. The Tree has MULTI-LEVEL nodes and the user can click on any of the nodes which will
trigger a report (rellevant for that node) to appear in the REPORT container.
<p>
Everythign is working fine.
<p>
I now have a requirement to add a TREE ON/OFF functionality. I have added this by 'Freeing' TREE
container and by initializing when the user Turns ON the TREE. It is working fine, HOWEVER, when
it initilizes the TREE it is COLLAPSED and obviously does not point to the NODE that was clicked.
<p>
My goal is to retain the value of the NODE that was pressed and EXPAND the tree to that node and
highlight it... Please note that I have MULTI-LEVEL nodes and the user can double click on NODES
and ITEMS.
<p>
I tried using GET_SELECTED_NODES, but it only works if the user selects the LOWEST level node/item.
<p>
Any advise will be appreciated.
<p>
Also, as an alternative, I was thinking of resizing TREE container to WIDTH of 1 when the user PRESSES
TREE OFF and resizing back to width 200 when the user presses TREE ON. I could not find any methods
that would work with CL_GUI_DOCKING_CONTAINER.
Please help! Thank you in advance.
<br>
<br>
<img src="http://img237.imageshack.us/img237/6684/bdccz3.jpg" border="0"/></a>
<p>
<p> -
Error calling a method of the tree control in BDC
I'm connecting two systems Iplan(project management tool) with SAP PS using SAP XI.
I've written an BDC(RFC) to assign people for the activity in an project(cj20n) it works fine in the foreground. But it doesn't work in the background.It doesn't give me error also.I've sap all authorization.
When I connect with XI its throwing me an error "Error calling a method of the tree control" message type A (using the same user to connect r3). I believe something we should do prior handling the tree control in a BDC. IF any body come across this situation please let me know. your help is appreciated.
Regards
AnandBDCs over enjoy transactions do not get along together. The containers and controls is more of a gui thing, and in background sometimes the BDC has a hard time with them. I would suggest using the non-enjoy tcode instead, CJ20.
Regards,
Rich Heilman -
Tree control: How to disable the selection of a child item
Hello everyone,
Im having trouble with disabling the selection of a child item in a tree control. I dont know if its possible but havent found any answers on this forum regarding this issue.
Example:
Parent tag 1
child item 1
child item 2
Parent tag 2
child item a
child item b
What i would like to do is being able to select the parent tags but not the child items, because i use the name of the selected item in my program to determine which actions are allowed and those that are not. To avoid this problem i look at the first 4 letters of the name and this way i can determine if it is a parent tag or child item and take appropriate action. Im able to do this because the parent tags have fixed names. But even though nothing happens in software if i select a child item it still lights up, so for the user of the program it looks as if the child items is selected but the program doesnt do anything(because i made it that way). Thats why i want to be able to disable the selection of the child item or at least make the selection colour of the child item transparant so it doesnt look like it is selected.
Can anyone help me with this problem, if there are parts of my question you dont understand, just ask.
greetz
Ynse.Muks,
your last image disables the whole tree.
To programmatically disables an item use ActiveItem.Disabled? property.
Unfortunately this only has two states, Enabled and disabled (thus grayed).
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
How to design a listbox or tree control related to the database
Now i have a problem to design a listbox or tree control, it is designed to connect to the database, if the related element in database changed, the element in listbox or tree control should also change. i have managed to read the element in database, but i cannot input it to the listbox or tree control, since it has no input terminal that i can only use the Labeling tool and enter text into it.
is there any advise on it, maybe i can use another control rather than listbox or tree control. any suggestion would be appreciate.
Thank you
XuYHi Xuy,
On the front-panel, right-click on the text-ring control and select: Create\Property Node.
Then, on the diagram, right-click on the property-node and select "Strings[]".
The "strings[]" property is the array of strings available in the control - and you can change it.
Cheers!
Message Edited by tbd on 04-05-2007 11:18 PM
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Attachments:
RingStrings.jpg 6 KB -
How to get access to Row Data (Child Text) in a Tree Control Pragmatically?
In LabVIEW 2010, I have entered Row Data into a Tree Control pragmatically using the Add Item method and providing the Child Text array and the Child Tag for the Row. When a Row in the Tree Control is selected, I can get the Row Tag in the Value Property of the Tree. But how do I access the Child Text array data when the Row is selected? I can't seem to find a Tree Control Property or Method that will return that data back again.
What I am trying to do is: once a Row in a Tree is selected and a button is pushed, if the Row Tag is valid, I want to transfer all of the Row data into another similarly formatted Tree. To do that I need the Row Data for the Tree and Row that was selected. I can not find a way to get access to this Row Data after it has been entered into the Tree.
Can anyone tell me how to pragmatically access the Child Text or Row Data in a Tree Control from a selected Row in the Tree? I have the Tag for the Row, but how do I access the data?
Thanks for your assistance.
Solved!
Go to Solution.As mentioned in the posting here, you can use the Active Item:Tag property to set the item to which subsequent property changes apply. This includes pulling the Active Celltring values out in a for loop as you increment the Active Cell:Active Column Number to get the row's Child Text data programmatically as I was originally wanting to do.
Note that wiring a 0 to the ActiveColNum property and reading the String value will return the tree item's visible name (in column 0), but not the unique item Tag (which is somewhat intangible after its creation). Therefore, I save the unique item tag when I add the item to the tree control (the output of the Add Item invoke node) and store it as a separate column of the Child Text array and place it out of sight in the tree control so I have access to it later. It might be useful, it might not.
I find the tree control totally non-intuitive and not well explained anywhere, but that's how a lot of LabVIEW coding is I guess. Play with it long enough and you become an expert. I had to learn the hard way, but I hope this helps someone else.
-Richard
"Computers are useless. They can only give you answers." - Pablo Picasso
Maybe you are looking for
-
Problem syncing large photo library
I have a iPad 64GB and cannot sync my iPhoto library of 7000 photos. It syncs then states then when I select the photos on the ipad it hands saying "updating library" then crashes. The library syncs fine to my iPhone and everything else seems to work
-
Hi, I have created a report using 'PL/SQL function body returning SQL Query'. The columns in the report are dynamically generated.I have selected the option 'Use Generic Column Names (parse query at runtime only)'.Also the option 'Function returning
-
How many warehouses are effective or available ?
Hi, everybody~ There are more than 30 warehouses in a company. Is there any problem to effectively run SAP B1 with more than 30 or 50 warehouses?
-
Why no multitasking gestures for iphone in ios5?
I was just reading the iOS 5 features list and noticed that multitasking gestures would be integrated into the new update, but it seemed to indicate it will only available on the iPad and not the iPhone! Is this true and if so what is the reason? On
-
How do I import from old podcast library?
I just reinstalled Vista a few days ago. I backed up my iTunes podcasts (25g worth). How do I get those podcasts back in my list so I do not have to re-download all of them? *Update* Nevermind. Files just finished being transferred and everything is