Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » is this a tableTree bug?
is this a tableTree bug? [message #466064] Fri, 30 December 2005 14:08 Go to next message
Yichao Zhang is currently offline Yichao ZhangFriend
Messages: 7
Registered: July 2009
Junior Member
Hello everyone.

A TableTree with 2 columns cann't fire off event when I click on the
second column. It can only fire with the first column.

my code as following:

Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI);
TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
column1.setText("option");
column1.setWidth(250);
TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
column2.setText("value");
column2.setWidth(350);
for (int i=0; i<12; i++) {
TreeItem treeItem = new TreeItem (tree, SWT.NONE);
treeItem.setText (new String[]{"Item " + i,i+"hh"});
}
tree.addListener (SWT.MouseDown, new Listener () {
public void handleEvent (Event event) {
Point point = new Point (event.x, event.y);
TreeItem item = tree.getItem (point);
if (item != null) {
System.out.println ("Mouse down: " +item);
}
}
});

it shows :

item0 0hello
item1 1hello
item2 2hello

when i click on the "item0",it fires.but it can not fire when click on
the "0hello"

any clue?
Re: is this a tableTree bug? [message #466089 is a reply to message #466064] Sat, 31 December 2005 15:41 Go to previous messageGo to next message
Yichao Zhang is currently offline Yichao ZhangFriend
Messages: 7
Registered: July 2009
Junior Member
Hi all

how can I do to raise the selection event when click on the second
column?

any pointer welcome.

--Yichao


On Fri, 30 Dec 2005 22:08:49 +0800, Yichao Easter Zhang
<Yichao.Zhang@gmail.com> wrote:

>Hello everyone.
>
>A TableTree with 2 columns cann't fire off event when I click on the
>second column. It can only fire with the first column.
>
>my code as following:
>
> Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI);
> TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
> column1.setText("option");
> column1.setWidth(250);
> TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
> column2.setText("value");
> column2.setWidth(350);
> for (int i=0; i<12; i++) {
> TreeItem treeItem = new TreeItem (tree, SWT.NONE);
> treeItem.setText (new String[]{"Item " + i,i+"hh"});
> }
> tree.addListener (SWT.MouseDown, new Listener () {
> public void handleEvent (Event event) {
> Point point = new Point (event.x, event.y);
> TreeItem item = tree.getItem (point);
> if (item != null) {
> System.out.println ("Mouse down: " +item);
> }
> }
> });
>
>it shows :
>
>item0 0hello
>item1 1hello
>item2 2hello
>
>when i click on the "item0",it fires.but it can not fire when click on
>the "0hello"
>
>any clue?
Re: is this a tableTree bug? [message #466104 is a reply to message #466089] Mon, 02 January 2006 12:49 Go to previous message
Yichao Zhang is currently offline Yichao ZhangFriend
Messages: 7
Registered: July 2009
Junior Member
Hi all

I got the answer by buzilla now.
The tree should be initialized by :

Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI |
SWT.FULL_SELECTION);

-Yichao Easter


On Sat, 31 Dec 2005 23:41:30 +0800, Yichao Easter Zhang
<Yichao.Zhang@gmail.com> wrote:

>Hi all
>
>how can I do to raise the selection event when click on the second
>column?
>
>any pointer welcome.
>
>--Yichao
>
>
>On Fri, 30 Dec 2005 22:08:49 +0800, Yichao Easter Zhang
><Yichao.Zhang@gmail.com> wrote:
>
>>Hello everyone.
>>
>>A TableTree with 2 columns cann't fire off event when I click on the
>>second column. It can only fire with the first column.
>>
>>my code as following:
>>
>> Tree tree = new Tree (shell, SWT.BORDER | SWT.MULTI);
>> TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
>> column1.setText("option");
>> column1.setWidth(250);
>> TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
>> column2.setText("value");
>> column2.setWidth(350);
>> for (int i=0; i<12; i++) {
>> TreeItem treeItem = new TreeItem (tree, SWT.NONE);
>> treeItem.setText (new String[]{"Item " + i,i+"hh"});
>> }
>> tree.addListener (SWT.MouseDown, new Listener () {
>> public void handleEvent (Event event) {
>> Point point = new Point (event.x, event.y);
>> TreeItem item = tree.getItem (point);
>> if (item != null) {
>> System.out.println ("Mouse down: " +item);
>> }
>> }
>> });
>>
>>it shows :
>>
>>item0 0hello
>>item1 1hello
>>item2 2hello
>>
>>when i click on the "item0",it fires.but it can not fire when click on
>>the "0hello"
>>
>>any clue?
Previous Topic:Viewer for collection of text fields
Next Topic:How to get a notification when a composite has been clicked
Goto Forum:
  


Current Time: Fri Apr 19 19:26:42 GMT 2024

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

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

Back to the top