Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to capture MouseEvents on a TableColumn
How to capture MouseEvents on a TableColumn [message #437604] Tue, 08 June 2004 18:03 Go to next message
Erik  Lundström is currently offline Erik LundströmFriend
Messages: 22
Registered: July 2009
Junior Member
Does anyone know how MouseEvents can be observed on a TableColumn?

For sure, SelectionListeners can be added to a TableColumn, but that does
not do the trick, since right-click events are not captured. Adding a
MouseListener to the underlying Table control is no good either, since it
does not issue any events on the table header/columns.

The lack of this basic feature (like presenting a context menu for a column,
for instance) is quite a show stopper in my application. Therefore, any help
is greatly appreciated!

Cheers

Erik
Re: How to capture MouseEvents on a TableColumn [message #437640 is a reply to message #437604] Wed, 09 June 2004 00:06 Go to previous messageGo to next message
Michael Xia is currently offline Michael XiaFriend
Messages: 119
Registered: July 2009
Senior Member
I haven't tried it, but try to just use addListener().

TableColumn.addListener(SWT.MouseDown, new Listener() {
public void handleEvent(Event event) {
}
});

Then in handleEvent(), you could check if it's right or left mouse click
and process it accordingly.

Michael
Re: How to capture MouseEvents on a TableColumn [message #437643 is a reply to message #437640] Wed, 09 June 2004 06:33 Go to previous messageGo to next message
Erik  Lundström is currently offline Erik LundströmFriend
Messages: 22
Registered: July 2009
Junior Member
Michael,

thanks for your suggestion. I did try your approach as well, however with no
effect. No events reach the handleEvent-method at all, which confuses me.
Enlighten me please, anyone?!?

I think the underlying "problem" (regarding my original ?: how to capture
mouse events on a TC) might be that headers of Table objects are
"unreachable", since Eclipse relies heavily on the OS for this. But then
again, it is possible to add a SelectionListener to a TableColumn, so why
should it be impossible to add a MouseListener?!?

Any help on this topic is very welcome.

Erik



"Michael Xia" <yun@rti.com> skrev i meddelandet
news:ca5ka1$nog$1@eclipse.org...
> I haven't tried it, but try to just use addListener().
>
> TableColumn.addListener(SWT.MouseDown, new Listener() {
> public void handleEvent(Event event) {
> }
> });
>
> Then in handleEvent(), you could check if it's right or left mouse click
> and process it accordingly.
>
> Michael
>
>
Re: How to capture MouseEvents on a TableColumn [message #437655 is a reply to message #437604] Wed, 09 June 2004 14:07 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
This is a known issue, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=17871 .

Grant

"Erik Lundstrom" <erik.lundstrom@solme.se> wrote in message
news:ca4uhr$td4$1@eclipse.org...
> Does anyone know how MouseEvents can be observed on a TableColumn?
>
> For sure, SelectionListeners can be added to a TableColumn, but that does
> not do the trick, since right-click events are not captured. Adding a
> MouseListener to the underlying Table control is no good either, since it
> does not issue any events on the table header/columns.
>
> The lack of this basic feature (like presenting a context menu for a
column,
> for instance) is quite a show stopper in my application. Therefore, any
help
> is greatly appreciated!
>
> Cheers
>
> Erik
>
>
Re: How to capture MouseEvents on a TableColumn [message #437719 is a reply to message #437655] Wed, 09 June 2004 15:18 Go to previous messageGo to next message
Erik  Lundström is currently offline Erik LundströmFriend
Messages: 22
Registered: July 2009
Junior Member
Thanks Grant.

Has anyone perhaps developed a workaround for this, or custom 'emulated'
table + table column widgets that does not rely on the OS?

Erik.

"Grant Gayed" <grant_gayed@ca.ibm.com> skrev i meddelandet
news:ca753b$bhr$1@eclipse.org...
> This is a known issue, see
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=17871 .
>
> Grant
>
> "Erik Lundstrom" <erik.lundstrom@solme.se> wrote in message
> news:ca4uhr$td4$1@eclipse.org...
> > Does anyone know how MouseEvents can be observed on a TableColumn?
> >
> > For sure, SelectionListeners can be added to a TableColumn, but that
does
> > not do the trick, since right-click events are not captured. Adding a
> > MouseListener to the underlying Table control is no good either, since
it
> > does not issue any events on the table header/columns.
> >
> > The lack of this basic feature (like presenting a context menu for a
> column,
> > for instance) is quite a show stopper in my application. Therefore, any
> help
> > is greatly appreciated!
> >
> > Cheers
> >
> > Erik
> >
> >
>
>
Re: How to capture MouseEvents on a TableColumn [message #437840 is a reply to message #437643] Thu, 10 June 2004 20:30 Go to previous messageGo to next message
Brion Vibber is currently offline Brion VibberFriend
Messages: 21
Registered: July 2009
Junior Member
Erik Lundstrom wrote:
> I think the underlying "problem" (regarding my original ?: how to capture
> mouse events on a TC) might be that headers of Table objects are
> "unreachable", since Eclipse relies heavily on the OS for this. But then
> again, it is possible to add a SelectionListener to a TableColumn, so why
> should it be impossible to add a MouseListener?!?

Note that you can't rely on being able to use a SelectionListener either
on a TableColumn; it doesn't work on Mac OS X, for instance. Be sure to
provide another way to get at the functions you'd use this for.

-- brion vibber (brion @ pobox.com)
Re: How to capture MouseEvents on a TableColumn [message #559659 is a reply to message #437840] Fri, 17 September 2010 14:20 Go to previous messageGo to next message
Jatin is currently offline JatinFriend
Messages: 7
Registered: April 2010
Location: United States
Junior Member
Hi Eric

I am sailing in same boat as you were. Were you able to capture mouse events on a Table Column. I have urgent client requirement to popup a dialog of right click on TableColumn.

SelectionListener works fine for left mouse click on tableColumn.

I tried to addListener, but It doesn't get rightclick mouse event.

TableColumn.addListener(SWT.MouseDown, new Listener() {
> public void handleEvent(Event event) {
> }
> });


Any help / suggestion regarding this would be greatly appreciated.

Thanks
Jatin Vasa
Re: How to capture MouseEvents on a TableColumn [message #1230934 is a reply to message #559659] Mon, 13 January 2014 12:07 Go to previous messageGo to next message
M M is currently offline M MFriend
Messages: 4
Registered: June 2013
Junior Member
I have the same problem.
Has anybody found a solution / fix for this?

Thanks!
Re: How to capture MouseEvents on a TableColumn [message #1231766 is a reply to message #1230934] Wed, 15 January 2014 10:50 Go to previous message
M M is currently offline M MFriend
Messages: 4
Registered: June 2013
Junior Member
Actually, I found this snippet that show how to do this:

Cool
Previous Topic:How can I integrate a native application ( like putty.exe ) with SWT shell ?
Next Topic:Xulrunner 25 with Eclipse
Goto Forum:
  


Current Time: Fri Mar 29 06:26:44 GMT 2024

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

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

Back to the top