[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: How to make a popup shell close when mouse clicked anywhereoutside the shell

No it doesn't there can always be only 1 control which has the focus! So if you put the focus into a Text-Widget inside the Shell the shell will lose the focus.


Tom

Wayne Beaton schrieb:
I was thinking about this last night (but was too lazy to boot up).

Doesn't the shell have focus as long as anything it contains has focus?
The only time I've ever used this trick, I only had a shell (that I drew
on via a PaintListener).

I suppose I could set up a little test... (but apparently last evening's
laziness is still with me)

Wayne

On Mon, 2008-06-09 at 15:02 -0400, Grant Gayed wrote:
I think Deactivate is a better listener to hook on the Shell, to more easily
indicate whether focus is anywhere within the shell or not.

Grant


"Wayne Beaton" <wayne@xxxxxxxxxxx> wrote in message news:1213025476.6185.16.camel@xxxxxxxxxx
Try putting a focus listener on the shell; close it when you lose focus.
I believe that this should have the effect you're looking for.

HTH,

Wayne

On Mon, 2008-06-09 at 09:43 -0500, Hongying Zhang wrote:
Hello,
I need create a Popup Shell that will be popuped up when mouse click a
control, and this popup shell has to be resizable with some other
feature; this popup shell also need have a behavior that when the mouse
clicked outside popup Shell, this popup shell will close (just like menu
behavior ). Since I cannot subclass SWT Menu widget, so I created my own
Popup shell class.

Now, I have problem to close it when mouse clicked somewhere outside the
popup shell. I tried to let the shell listen to mouse up event, but that
won'y work. Can someone please let me know what should I do to make this
popup shell close when mouse clicked outside the Shell.

Thanks,
Hongying




--
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl                                          JFace-Committer
--------------------------------------------------------------------