is this a tableTree bug? [message #466064] |
Fri, 30 December 2005 09:08  |
Eclipse User |
|
|
|
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 10:41   |
Eclipse User |
|
|
|
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 07:49  |
Eclipse User |
|
|
|
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?
|
|
|
Powered by
FUDForum. Page generated in 0.06329 seconds