Checking & Greying tree items [message #452417] |
Mon, 21 March 2005 08:45 |
Alex Chan Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Hi all, Here's what I would like to achieve, but haven't been able to
solve at the moment. I have a main tree called tree1. Within my main tree
I have a treeItem called treeItemA. treeItemA consists of two child
treeItems namely treeItemB and treeItemC. What I would like to achieve are
the following conditions:
1. if treeItemB & treeItemC are checked, treeItemA is checked but not
grayed
2. if either one of treeItemB or threeItemC is checked (B checked & C not
OR C checked & B not), treeItemA is grayed.
3. if treeItemA is checked, both treeItemB & treeItemC are checked.
Here's my code for the time being:
{
tree1 = new Tree(composite2, SWT.CHECK);
FormData tree1LData = new FormData();
tree1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if(treeItemA.getChecked()){
//do something here to meet the above stated conditions
}
if(treeItemB.getChecked()){
//do something here to meet the above stated conditions
}
if(treeItemC.getChecked()){
//do something here to meet the above stated conditions
}
}
});
tree1LData.height = 213;
tree1LData.width = 474;
tree1LData.left = new FormAttachment(0, 1000, 2);
tree1LData.top = new FormAttachment(0, 1000, 3);
tree1.setLayoutData(tree1LData);
{
treeItemA = new TreeItem(tree1,SWT.NONE);
treeItemA.setText("A");
treeItemA.setExpanded(true);
{
treeItemB = new TreeItem(treeItemA,SWT.NONE);
treeItemB.setText("B");
}
{
treeItemC = new TreeItem(treeItemA,SWT.NONE);
treeItemC.setText("C");
}
}
}
Anyone here mind helping me out on solving this problem?...So far, I can't
get the action sequence to fire properly...The conditions have to be met
abitrarily where the user has the flexibility of checking either one of
treeItemA or treeItemB or treeItemC first...Thanks in advance guys!!!
Cheers
|
|
|
Powered by
FUDForum. Page generated in 0.03017 seconds