Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to propagete parent Event Listener?
How to propagete parent Event Listener? [message #441116] Tue, 10 August 2004 14:31 Go to next message
Roman is currently offline RomanFriend
Messages: 17
Registered: July 2009
Junior Member
Composite textPanel = new Composite(shell, SWT.NONE);
Label titleLabel1= new Label(textPanel,SWT.NONE);
Label titleLabel2= new Label(textPanel,SWT.NONE);
Label titleLabel3= new Label(textPanel,SWT.NONE);
....
Label titleLabel999= new Label(textPanel,SWT.NONE);

textPanel.addListener (SWT.MouseDown, listener);

Is there a way to not to add listener to all of 999 children?

Thanks.
Re: How to propagete parent Event Listener? [message #441132 is a reply to message #441116] Tue, 10 August 2004 16:18 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
No but you can investigate Display.addFilter(). This will let you see an
event for any widget on the Display (overkill). When the user clicks on a
Label, they don't expect any action to occur. What are you trying to do?

"Roman" <dostick@apollo.lv> wrote in message
news:cfam8t$8e1$1@eclipse.org...
>
> Composite textPanel = new Composite(shell, SWT.NONE);
> Label titleLabel1= new Label(textPanel,SWT.NONE);
> Label titleLabel2= new Label(textPanel,SWT.NONE);
> Label titleLabel3= new Label(textPanel,SWT.NONE);
> ...
> Label titleLabel999= new Label(textPanel,SWT.NONE);
>
> textPanel.addListener (SWT.MouseDown, listener);
>
> Is there a way to not to add listener to all of 999 children?
>
> Thanks.
>
Re: How to propagete parent Event Listener? [message #441174 is a reply to message #441132] Tue, 10 August 2004 16:45 Go to previous messageGo to next message
Roman is currently offline RomanFriend
Messages: 17
Registered: July 2009
Junior Member
I have window without chrome (no titlebar)
I want the window to be draggable when dragged by clicking anywhere.
If i attach listeners to shell- window is draggable only if user clicks
between elements; labels, etc.
So, to make window draggable when clicked anywhere I need to add listeners
to every element ti has?

maybe it's possible to make some kind of invisible layer in front of all
elements and attach drag listeners to it? That may work, but I have one
drag-less element, the close button. So if I had this layer, it will cover
everything and it will be impossible to close the window.

Any suggestions?
Roman.

Steve Northover wrote:

> No but you can investigate Display.addFilter(). This will let you see an
> event for any widget on the Display (overkill). When the user clicks on a
> Label, they don't expect any action to occur. What are you trying to do?

> "Roman" <dostick@apollo.lv> wrote in message
> news:cfam8t$8e1$1@eclipse.org...
> >
> > Composite textPanel = new Composite(shell, SWT.NONE);
> > Label titleLabel1= new Label(textPanel,SWT.NONE);
> > Label titleLabel2= new Label(textPanel,SWT.NONE);
> > Label titleLabel3= new Label(textPanel,SWT.NONE);
> > ...
> > Label titleLabel999= new Label(textPanel,SWT.NONE);
> >
> > textPanel.addListener (SWT.MouseDown, listener);
> >
> > Is there a way to not to add listener to all of 999 children?
> >
> > Thanks.
> >
Re: How to propagete parent Event Listener? [message #441187 is a reply to message #441174] Wed, 11 August 2004 15:23 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
1) Make it draggable only when the user clicks in the title bar (a widget
that you wrote, possibly a label)?
2) A disabled widget will not see mouse events. If you place a Composite as
the first child of the shell and disable it, then the mouse events for the
children and the Composite will go to the shell. This is a bit of a hack
and it means that you can never have childrent want focus (like a Text
control for example).

"Roman" <dostick@apollo.lv> wrote in message
news:cfau41$mn4$1@eclipse.org...
> I have window without chrome (no titlebar)
> I want the window to be draggable when dragged by clicking anywhere.
> If i attach listeners to shell- window is draggable only if user clicks
> between elements; labels, etc.
> So, to make window draggable when clicked anywhere I need to add listeners
> to every element ti has?
>
> maybe it's possible to make some kind of invisible layer in front of all
> elements and attach drag listeners to it? That may work, but I have one
> drag-less element, the close button. So if I had this layer, it will cover
> everything and it will be impossible to close the window.
>
> Any suggestions?
> Roman.
>
> Steve Northover wrote:
>
> > No but you can investigate Display.addFilter(). This will let you see
an
> > event for any widget on the Display (overkill). When the user clicks on
a
> > Label, they don't expect any action to occur. What are you trying to
do?
>
> > "Roman" <dostick@apollo.lv> wrote in message
> > news:cfam8t$8e1$1@eclipse.org...
> > >
> > > Composite textPanel = new Composite(shell, SWT.NONE);
> > > Label titleLabel1= new Label(textPanel,SWT.NONE);
> > > Label titleLabel2= new Label(textPanel,SWT.NONE);
> > > Label titleLabel3= new Label(textPanel,SWT.NONE);
> > > ...
> > > Label titleLabel999= new Label(textPanel,SWT.NONE);
> > >
> > > textPanel.addListener (SWT.MouseDown, listener);
> > >
> > > Is there a way to not to add listener to all of 999 children?
> > >
> > > Thanks.
> > >
>
>
Previous Topic:embedded AWT canvas not always repainted
Next Topic:Selecting Text on more than one StyledText
Goto Forum:
  


Current Time: Thu Apr 25 10:28:18 GMT 2024

Powered by FUDForum. Page generated in 0.03228 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top