Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Does Table support SWT.MouseDoubleClick events?
Does Table support SWT.MouseDoubleClick events? [message #460215] Mon, 22 August 2005 21:08 Go to next message
Andy Arhelger is currently offline Andy ArhelgerFriend
Messages: 62
Registered: July 2009
Member
I can't seem to get Table to handle SWT.MouseDoubleClick events.
Does Table support these events?

Andy Arhelger
Re: Does Table support SWT.MouseDoubleClick events? [message #460223 is a reply to message #460215] Mon, 22 August 2005 22:52 Go to previous messageGo to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
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 #460256 is a reply to message #460223] Tue, 23 August 2005 13:54 Go to previous messageGo to next message
Andy Arhelger is currently offline Andy ArhelgerFriend
Messages: 62
Registered: July 2009
Member
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 #460265 is a reply to message #460256] Tue, 23 August 2005 14:32 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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 #460269 is a reply to message #460265] Tue, 23 August 2005 15:06 Go to previous messageGo to next message
Andy Arhelger is currently offline Andy ArhelgerFriend
Messages: 62
Registered: July 2009
Member
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 #460278 is a reply to message #460269] Tue, 23 August 2005 16:10 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
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 Go to previous messageGo to next message
Andy Arhelger is currently offline Andy ArhelgerFriend
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()?
>>>>>
>>>
>>>
>>>
>
>
Re: Does Table support SWT.MouseDoubleClick events? [message #460305 is a reply to message #460256] Wed, 24 August 2005 00:14 Go to previous messageGo to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
Andy Arhelger wrote:

> 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

Could you post a snippet?

Using a mouse listener on a table should give you the ability to capture
double clicks anywhere on the table. Using a selection listener should
give the ability to capture table selections with single (widgetSelected)
and/or double clicks (widgetDefaultSelected). So I'm not sure why its not
working in your case, but a snippet would be useful.

Chris.
Re: Does Table support SWT.MouseDoubleClick events? [message #460307 is a reply to message #460290] Wed, 24 August 2005 00:19 Go to previous messageGo to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
Andy Arhelger wrote:

> I do have FULL_SELECTION set. But I also have a TableCursor. TableCursor
> seems to be preventing the default selection event.

> Andy Arhelger


Andy,

have you tried adding a selectionListener to the TableCursor itself,
rather than the Table? (using widgetDefaultSelected() )
Re: Does Table support SWT.MouseDoubleClick events? [message #460404 is a reply to message #460307] Wed, 24 August 2005 18:25 Go to previous message
Andy Arhelger is currently offline Andy ArhelgerFriend
Messages: 62
Registered: July 2009
Member
Chris:

Thanks, that did the trick!

Andy Arhelger

Chris wrote:
> Andy Arhelger wrote:
>
>> I do have FULL_SELECTION set. But I also have a TableCursor.
>> TableCursor seems to be preventing the default selection event.
>
>
>> Andy Arhelger
>
>
>
> Andy,
>
> have you tried adding a selectionListener to the TableCursor itself,
> rather than the Table? (using widgetDefaultSelected() )
>
Previous Topic:Sections of a perspective
Next Topic:swt browser on pocket pc
Goto Forum:
  


Current Time: Thu Apr 25 22:37:17 GMT 2024

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

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

Back to the top