Community
Participate
Working Groups
In Windows, clicking on a Combo control fires a FocusEvent. Clicking on a Combo in GTK or OS X does not generate the event.
moving to SWT
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.
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.
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 ?
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?
(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 ?
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. :)
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.
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.
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...
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.
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.