[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: When can setFocus return false?

Hi Michal,

There are a few contexts where controls don't take focus, but your case of a
Text not taking it but then taking it in an immediate re-try sounds strange.
Are you able to provide a snippet that shows this happening (example snippet
template: http://www.eclipse.org/swt/faq.php#whatisasnippet )?  Can you see
if this still happens with a recent eclipse/swt like
http://download.eclipse.org/eclipse/downloads/drops/S-3.4M6a-200804091425/index.php ?

Grant


"Michal Dobisek" <Michal.Dobisek@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:funcsr$foc$1@xxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I am driving SWT UI by sending some messages from non-swt thread via
> Display.syncExec. This seems to work quite well, but I have a problem
> with the setFocus method: it behaves inconsistently. When invoking
> setFocus on the same control (Text in my case), I sometimes get false,
> sometimes true (true in most cases).
> If I re-try on false, I usually succeed next time (but I have to do it
> in next syncExec - i.e. giving SWT thread some time off).
>
> I found out, that setFocus returns false, when the control is disabled -
> but it doesn't seem to be my case.
>
> Are there some other conditions, under which a control can refuse focus
> (and which can change during the control lifetime)? (I am on Windows,
> Eclipse 3.0).
>
> Thanks for suggestions,
>
> Michal