Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Tree widget
Tree widget [message #442298] Tue, 31 August 2004 22:24 Go to next message
Melih is currently offline MelihFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I created a Tree widget with:

avTree = new Tree(avTreeGroup,SWT.SINGLE| SWT.CHECK| SWT.BORDER);

After I added some TreeItems and run the program, I realized that if I
click on the name of a TreeItem, it gets highlighted, but clicking on the
checkbox next to a TreeItem just un/checks the box, it doesn't highlight
that item. How can I fix that?

If I added a SelectionListener, and get the widget whose checkbox is
modified by:
TreeItem selectedItem = (TreeItem) evt.item;


then how can I highlight that item?

Thanx
melih
Re: Tree widget [message #442299 is a reply to message #442298] Wed, 01 September 2004 00:33 Go to previous messageGo to next message
Simone Gianni is currently offline Simone GianniFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Melih,
maybe

tree.setSelection(new TreeItem[] { selectedItem });

could do the trick.

Ciao,
Simone Gianni

Melih wrote:

> Hi,
>
> I created a Tree widget with:
>
> avTree = new Tree(avTreeGroup,SWT.SINGLE| SWT.CHECK| SWT.BORDER);
>
> After I added some TreeItems and run the program, I realized that if I
> click on the name of a TreeItem, it gets highlighted, but clicking on the
> checkbox next to a TreeItem just un/checks the box, it doesn't highlight
> that item. How can I fix that?
>
> If I added a SelectionListener, and get the widget whose checkbox is
> modified by:
> TreeItem selectedItem = (TreeItem) evt.item;
>
>
> then how can I highlight that item?
>
> Thanx
> melih
>
>
>
Re: Tree widget [message #442300 is a reply to message #442299] Wed, 01 September 2004 01:04 Go to previous messageGo to next message
Melih is currently offline MelihFriend
Messages: 2
Registered: July 2009
Junior Member
Thanx Simone. But wouldn't it change the current selection array as well?

melih

Simone Gianni wrote:

> Hi Melih,
> maybe

> tree.setSelection(new TreeItem[] { selectedItem });

> could do the trick.

> Ciao,
> Simone Gianni

> Melih wrote:

> > Hi,
> >
> > I created a Tree widget with:
> >
> > avTree = new Tree(avTreeGroup,SWT.SINGLE| SWT.CHECK| SWT.BORDER);
> >
> > After I added some TreeItems and run the program, I realized that if I
> > click on the name of a TreeItem, it gets highlighted, but clicking on the
> > checkbox next to a TreeItem just un/checks the box, it doesn't highlight
> > that item. How can I fix that?
> >
> > If I added a SelectionListener, and get the widget whose checkbox is
> > modified by:
> > TreeItem selectedItem = (TreeItem) evt.item;
> >
> >
> > then how can I highlight that item?
> >
> > Thanx
> > melih
> >
> >
> >
Re: Tree widget [message #442303 is a reply to message #442300] Wed, 01 September 2004 08:21 Go to previous message
Simone Gianni is currently offline Simone GianniFriend
Messages: 29
Registered: July 2009
Junior Member
AFAIK, when a Tree has checks, it has two different "selections", one is
retrieved and set item by item with treeItem.setChecked() which refers
to the check; the other is get and set on the entire tree with
setSelection and getSelection and refers to the highlighted ones. They
are not necessarily coupled, at least not on Win XP, at least not in my
checked tree experiences :D

Ciao,
Simone Gianni



Melih wrote:

> Thanx Simone. But wouldn't it change the current selection array as well?
>
> melih
>
> Simone Gianni wrote:
>
>
>>Hi Melih,
>>maybe
>
>
>>tree.setSelection(new TreeItem[] { selectedItem });
>
>
>>could do the trick.
>
>
>>Ciao,
>>Simone Gianni
>
>
>>Melih wrote:
>
>
>>>Hi,
>>>
>>>I created a Tree widget with:
>>>
>>>avTree = new Tree(avTreeGroup,SWT.SINGLE| SWT.CHECK| SWT.BORDER);
>>>
>>>After I added some TreeItems and run the program, I realized that if I
>>>click on the name of a TreeItem, it gets highlighted, but clicking on the
>>>checkbox next to a TreeItem just un/checks the box, it doesn't highlight
>>>that item. How can I fix that?
>>>
>>>If I added a SelectionListener, and get the widget whose checkbox is
>>>modified by:
>>>TreeItem selectedItem = (TreeItem) evt.item;
>>>
>>>
>>>then how can I highlight that item?
>>>
>>>Thanx
>>>melih
>>>
>>>
>>>
>
>
>
Previous Topic:probelms with TreeViewer.setInput(...)
Next Topic:experimental print support on linux/gtk
Goto Forum:
  


Current Time: Fri Apr 19 01:01:30 GMT 2024

Powered by FUDForum. Page generated in 0.02082 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top