Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » MouseAdapter behaving differently in Mac OS X(MouseAdapter behaving differently in Mac OS X)
MouseAdapter behaving differently in Mac OS X [message #1387845] Wed, 25 June 2014 17:23 Go to next message
Juan Luis Jimenez is currently offline Juan Luis JimenezFriend
Messages: 3
Registered: June 2014
Junior Member
Hi all,

I recently ported one of our Eclipse RCP applications to Mac OS X. The application is behaving OK except for a detail I believe related to SWT.

A part of our code uses a class that inherits from Label but behaves as a button. For that we use mouse adapters and internal statuses to detect changes.

On Windows and Linux, the behaviour of the button is triggered by a single click. However, on Mac OS I'm seeing that to trigger the button the user needs to double-click.

After the initial investigation, it seems that the mouseUp() event is not being triggered with the first click. This is not the case on Windows or Linux.

Any indications on what can be the root cause of this issue? Any help would be much appreciated.

Thanks a lot.

Juanlu
Re: MouseAdapter behaving differently in Mac OS X [message #1390896 is a reply to message #1387845] Mon, 30 June 2014 06:31 Go to previous messageGo to next message
Tomas R. is currently offline Tomas R.Friend
Messages: 7
Registered: July 2009
Junior Member
Please provide a working source-code that demonstrates this behaviour so the others can look at it in their free time.
In SWT, it is frequently necessary to differentiate beetween platforms it is used on, so I would use some if (Platform.isMacOSX()) {...} statement. But not in this case. If this were true, you should file a bug-report via eclipse's bugzilla.
Re: MouseAdapter behaving differently in Mac OS X [message #1391021 is a reply to message #1387845] Mon, 30 June 2014 10:34 Go to previous messageGo to next message
Juan Luis Jimenez is currently offline Juan Luis JimenezFriend
Messages: 3
Registered: June 2014
Junior Member
Hi,

I have attached the Java source file for our ImageButton class.

The class contains a main function that should be possible to run as a Java application for testing. The images referenced are not included in this email, though. They can be substituted with any images for testing purposes.

The class holds an internal state for the buttons and the image shown by the label varies with the state.

Although the code is not really mine, I have observed the following. On Windows and Linux, the mouseUp() method is invoked when I lift the click button the first time, whereas this doesn't happen on Mac OS. The mouseDown() event is also not invoked the first time the mouse button is pressed, on Mac OS X. It does on Windows/Linux.

Any pointers on what may be the root cause on this SWT events differences would be greatly appreciated.

Thanks,
Juanlu
Re: MouseAdapter behaving differently in Mac OS X [message #1391217 is a reply to message #1391021] Mon, 30 June 2014 15:55 Go to previous messageGo to next message
Tomas R. is currently offline Tomas R.Friend
Messages: 7
Registered: July 2009
Junior Member
Firstly: the Label class is not supposed to be subclassed -> I would suggest to subclass Composite instead and provide a common API.

Secondly try to create a less complex snippet of your code from scratch (minimal example of the functionality). I believe, that catching of the MouseEvents will work.
If not, paste it here and I will look at it more -- sorry, I'm bit overwhelmed by my own work at the moment.

[Updated on: Mon, 30 June 2014 15:57]

Report message to a moderator

Re: MouseAdapter behaving differently in Mac OS X [message #1391835 is a reply to message #1391217] Tue, 01 July 2014 13:34 Go to previous message
Juan Luis Jimenez is currently offline Juan Luis JimenezFriend
Messages: 3
Registered: June 2014
Junior Member
Thanks for the reply! Fixed the problem by inheriting from Canvas instead of Label. I don't know the reason why my ex-colleague inherited from Label, the documentation - as you pointed out - discourages it. Thanks for the hint!
Previous Topic:Buttons in setTabList do no accept focus
Next Topic:SWT Browser Separate Process
Goto Forum:
  


Current Time: Thu Apr 25 09:04:47 GMT 2024

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

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

Back to the top