How to propagate event to parent? [message #453920] |
Wed, 13 April 2005 22:47 |
Ellen Li 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 texts parent, IPText.
}
});
}
Thanks so much!!
Ellen
|
|
|
Powered by
FUDForum. Page generated in 0.02503 seconds