Bug 269739 - Click on Combo in GTK and OS X does not fire a FocusEvent
Summary: Click on Combo in GTK and OS X does not fire a FocusEvent
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-23 16:24 EDT by Kevin Smathers CLA
Modified: 2019-09-24 13:59 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Smathers CLA 2009-03-23 16:24:12 EDT
In Windows, clicking on a Combo control fires a FocusEvent.  Clicking on a Combo in GTK or OS X does not generate the event.
Comment 1 Chris Aniszczyk CLA 2009-03-23 16:26:03 EDT
moving to SWT
Comment 2 Felipe Heidrich CLA 2009-03-24 11:52:53 EDT
Works for me on Windows and Cocoa. Bog, please try on GTK (I'm 99.9% it works there too).

I tested with ControlExample, Combo tab, enable Listener click on the combo and click on other control. You can see focus in and focus out events in the console.
Comment 3 Kevin Smathers CLA 2009-03-24 12:05:17 EDT
I should have been more specific initially - the focus event doesn't get fired when the Combo is of style SWT.READ_ONLY.  It does receive focus on Windows, but not in OS X or GTK.  It's possible to tab to the control to give it focus, but clicking on the control does not appear to fire the event.
Comment 4 Felipe Heidrich CLA 2009-03-24 12:23:51 EDT
Right, I tested windows and cocoa again, for the read only case.

On windows, when you click on the combo it does get keyboards focus, i.e. you can use arrow up and arrow down to change the selection etc. The focus in event is sent.

On cocoa, when you click on the combo it does not get keyboard focus. The focus remains in the same control where it was before the click. The focus in event is not send, which is correct.

Bog, please try the same on GTK. If the combo does not get focus on click please close this bug.

Note, other controls behave the same, for example: toolitem, sash, button on mac, etc.

Kevin, is there a problem that you are trying to fix ?
Comment 5 Tom Bryan CLA 2009-03-24 12:29:59 EDT
Well, this kind of difference makes cross-platform SWT development really difficult.  I can code once and run the same UI on multiple operating systems, but event handling becomes nightmarish to test.  

Is there a listing somewhere of these types of platform differences that SWT developers should expect to encounter?
Comment 6 Felipe Heidrich CLA 2009-03-24 12:43:50 EDT
(In reply to comment #5)
> Well, this kind of difference makes cross-platform SWT development really
> difficult.  I can code once and run the same UI on multiple operating systems,
> but event handling becomes nightmarish to test.  

If you a specific case that you need to fix we can help you find a solution. Here or in the newsgroup.

Note: it is important to respect platform differences. For example, in macosx, giving focus to buttons on click would would disappoint real mac users.

> Is there a listing somewhere of these types of platform differences that SWT
> developers should expect to encounter?

Grant, do we have that around ? 
Comment 7 Kevin Smathers CLA 2009-03-24 13:38:07 EDT
What we are trying to do is trigger some code to look up Combo values when the user tries to view the values within that Combo.  I have tried moving away from Focus and using the Activate event instead.  This seems to work for OS X, Windows, and in most instances in GTK (Debian/Ubuntu this works, Red Hat Enterprise Linux rel 4 it does not).  The code I'm working on loads the values only when requested so we keep backend traffic to a minimum.  I'm happy to take this to the newsgroup if that's a more appropriate place to discuss this. :)
Comment 8 Felipe Heidrich CLA 2009-03-24 14:57:54 EDT
Sorry, I don't have an answer. Maybe a mix of focus in + mouse enter (too hacky) ?

Steve, Any ideas ?
Maybe something like CBN_DROPDOWN would help.
http://msdn.microsoft.com/en-us/library/bb775810(VS.85).aspx

Try the newsgroups, a lot more people there, maybe someone has solved this problem before.
Comment 9 Kevin Smathers CLA 2009-03-25 16:17:13 EDT
After a great deal of investigation, I think we've narrowed this down to a problem with older versions of GTK.  Windows, OS X, and more recent versions of GTK all kick off an event when a Combo is opened (Activate in all cases, Focus in some cases, Mouse Down in some cases).  Older versions of GTK do not emit any SWT events to which listeners can be registered.  The version of GTK we have seen the faulty behavior on is 2.4.13.
Comment 10 Bogdan Gheorghe CLA 2009-03-25 17:58:34 EDT
It looks as though a Read Only Combo on GTK < 2.8 doesn't send out Focus, Mouse Down or Activate events. Things look better with 2.8 onwards. Praveen to investigate...
Comment 11 Andreas Muelder CLA 2011-02-02 11:48:26 EST
I use a swt combo inside of a CellEditor and there is no focus lost event fired on Mac Os if the style is SWT.READ_ONLY. For all other styles it works well.
Comment 12 Lars Vogel CLA 2019-09-24 13:59:17 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.