[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] Re: Is this bug #35735 in Bugzilla?

Hi Bill,

I already wrote (2006-10-10) you how you work around your problem, you
register a mouse listener and force focus to your control:


> Hi Bill,
> 
> Ok. You definately have a focus problem. Your composite doesn't receive
> focus at that's why you don't get KeyEvents. So the magic you need is
> simply something like this:
> 
> ----------------8<----------------
> public Grid(Composite parent, int style) {
>   // ...
>   initListeners();
> }
> 
> private void initListeners() {
>    addMouseListener(new MouseAdapter() {
> 
>       @Override
>       public void mouseDown(MouseEvent e) {
>          forceFocus();
>       }
>    });
> }
> ----------------8<----------------
> 
> I've tested it and for me it works like a charme.
> 
> Tom

Tom



Bill Ewing schrieb:
> There sure are lots of bugs with the word "focus" in their title.
> 
> Could my bug described in this thread be the same as 35735?
> 
> To summarize: it appears adding any control within a composite may cause
> it to not gain focus and not be able to receive KeyEvent's. 
> Interestingly, it still can receive MouseEvents.
> 
> Could someone advise me about when fixes will be (or were) released?
> 
> I'm currently using SWT 3.1.2.
> 
> Thanks,
> BE
>