|
|
|
|
|
Re: Does Table support SWT.MouseDoubleClick events? [message #460278 is a reply to message #460269] |
Tue, 23 August 2005 16:10 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Andy,
I'm going to guess that you have a Table without FULL_SELECTION and are
trying to double-click in a non-0 column (?). If so, then selecting a cell
that's not in column 0 requires that the Table be created with
SWT.FULL_SELECTION. The snippet below demonstrates this.
If my guess was wrong then you can still try the snippet below (it fires
default selection for me), and if it works for you too then just modify it
to make it fail.
public static void main(String[] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setBounds (10,10,200,200);
Table table = new Table (shell, SWT.FULL_SELECTION);
table.setBounds (10,10,150,100);
new TableColumn(table, SWT.NONE).setWidth(75);
new TableColumn(table, SWT.NONE).setWidth(75);
new TableItem(table, SWT.NONE).setText(new String[] {"item c0","item
c1"});
table.addListener(SWT.DefaultSelection, new Listener() {
public void handleEvent(Event e) {
System.out.println("default selection: " + e.toString());
}
});
shell.open ();
while (!shell.isDisposed ()){
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
Grant
"Andy Arhelger" <juggle@us.ibm.com> wrote in message
news:defe22$fjf$1@news.eclipse.org...
> On Windows, SWT 3.1. Tried again. Enter works but not double click. I
> can try to create a stand-alone.
>
> Andy Arhelger
>
> Grant Gayed wrote:
> > Listening for DefaultSelection should notify you for both Enter presses
and
> > for double clicks. Do you have a case where this is not happening? If
so,
> > which platform are you on, and can you post a stand-alone snippet that
shows
> > the problem?
> >
> > Grant
> >
> > "Andy Arhelger" <juggle@us.ibm.com> wrote in message
> > news:def9re$8vr$1@news.eclipse.org...
> >
> >>widgetDefaultSelected seems to get called when Enter is pressed not when
> >> the mouse is doubleclicked. I am trying to create a cell editor on
> >>double click. I would like single click to just select the row in the
> >>table and double click to edit the table cell.
> >>
> >>Andy Arhelger
> >>
> >>Chris wrote:
> >>
> >>>Andy Arhelger wrote:
> >>>
> >>>
> >>>>I can't seem to get Table to handle SWT.MouseDoubleClick events.
> >>>>Does Table support these events?
> >>>
> >>>
> >>>>Andy Arhelger
> >>>
> >>>
> >>>Is there any reason you can't use a selection listener ->
> >>>widgetDefaultSelected()?
> >>>
> >
> >
> >
|
|
|
Re: Does Table support SWT.MouseDoubleClick events? [message #460290 is a reply to message #460278] |
Tue, 23 August 2005 17:46 |
Andy Arhelger Messages: 62 Registered: July 2009 |
Member |
|
|
I do have FULL_SELECTION set. But I also have a TableCursor. TableCursor
seems to be preventing the default selection event.
Andy Arhelger
Grant Gayed wrote:
> Andy,
>
> I'm going to guess that you have a Table without FULL_SELECTION and are
> trying to double-click in a non-0 column (?). If so, then selecting a cell
> that's not in column 0 requires that the Table be created with
> SWT.FULL_SELECTION. The snippet below demonstrates this.
>
> If my guess was wrong then you can still try the snippet below (it fires
> default selection for me), and if it works for you too then just modify it
> to make it fail.
>
> public static void main(String[] args) {
> Display display = new Display ();
> Shell shell = new Shell (display);
> shell.setBounds (10,10,200,200);
> Table table = new Table (shell, SWT.FULL_SELECTION);
> table.setBounds (10,10,150,100);
> new TableColumn(table, SWT.NONE).setWidth(75);
> new TableColumn(table, SWT.NONE).setWidth(75);
> new TableItem(table, SWT.NONE).setText(new String[] {"item c0","item
> c1"});
> table.addListener(SWT.DefaultSelection, new Listener() {
> public void handleEvent(Event e) {
> System.out.println("default selection: " + e.toString());
> }
> });
> shell.open ();
> while (!shell.isDisposed ()){
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
>
> Grant
>
> "Andy Arhelger" <juggle@us.ibm.com> wrote in message
> news:defe22$fjf$1@news.eclipse.org...
>
>>On Windows, SWT 3.1. Tried again. Enter works but not double click. I
>>can try to create a stand-alone.
>>
>>Andy Arhelger
>>
>>Grant Gayed wrote:
>>
>>>Listening for DefaultSelection should notify you for both Enter presses
>
> and
>
>>>for double clicks. Do you have a case where this is not happening? If
>
> so,
>
>>>which platform are you on, and can you post a stand-alone snippet that
>
> shows
>
>>>the problem?
>>>
>>>Grant
>>>
>>>"Andy Arhelger" <juggle@us.ibm.com> wrote in message
>>>news:def9re$8vr$1@news.eclipse.org...
>>>
>>>
>>>>widgetDefaultSelected seems to get called when Enter is pressed not when
>>>> the mouse is doubleclicked. I am trying to create a cell editor on
>>>>double click. I would like single click to just select the row in the
>>>>table and double click to edit the table cell.
>>>>
>>>>Andy Arhelger
>>>>
>>>>Chris wrote:
>>>>
>>>>
>>>>>Andy Arhelger wrote:
>>>>>
>>>>>
>>>>>
>>>>>>I can't seem to get Table to handle SWT.MouseDoubleClick events.
>>>>>>Does Table support these events?
>>>>>
>>>>>
>>>>>>Andy Arhelger
>>>>>
>>>>>
>>>>>Is there any reason you can't use a selection listener ->
>>>>>widgetDefaultSelected()?
>>>>>
>>>
>>>
>>>
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03649 seconds