Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to propagate event to parent?
How to propagate event to parent? [message #453920] Wed, 13 April 2005 22:47
Ellen Li is currently offline Ellen LiFriend
Messages: 6
Registered: July 2009
Junior Member
I created a IPText widget extends Composite, which has 7 Text widgts as
children of “this”. It seems work fine.
public IPText ( Composite parent, int style) {
super(parent, style);

final FormLayout formLayout = new FormLayout();
this.setLayout(formLayout);

init();
createTextBoxes(); // create text boxes

}

I tried to register a listener
public void addModifyListener (ModifyListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Modify, typedListener);
}

But this listener does not catch modify event from its children, Text.

Is there any way I can propagate event to its parent? Such as :
public void addModifyListener (ModifyListener listener) {
checkWidget ();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Modify, typedListener);

//text is one of the children
text. addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// send ModifyEvent to text’s parent, IPText.
}
});
}


Thanks so much!!
Ellen
Previous Topic:Stop movement of slider
Next Topic:OT: How to fire an action and listen in another class
Goto Forum:
  


Current Time: Tue Mar 09 04:41:48 GMT 2021

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

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

Back to the top