Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337130

Summary: [Text] ModifyListeners are ignored when widget initially READ_ONLY
Product: [RT] RAP Reporter: RĂ¼diger Herrmann <ruediger.herrmann>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: b.fischer
Version: unspecified   
Target Milestone: 1.4 M6   
Hardware: All   
OS: All   
Whiteboard:

Description RĂ¼diger Herrmann CLA 2011-02-14 09:50:23 EST
The text widget does not fire modify events if it was created with the READ_ONLY style flag and made editable later on.
To reproduce, 
* run the code below
* click on the "Make editable" button
* then type into the text widget
=> no modify events are sent

public int createUI() {
	Display display = new Display();
	Shell shell = new Shell();
	shell.setLayout(new RowLayout());
	final Text text = new Text( shell, SWT.BORDER | SWT.READ_ONLY );
	text.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent event) {
			System.out.println( "ModifyEvent: " + event );
		}
	});
	Button button = new Button( shell, SWT.PUSH);
	button.setText("Make editable");
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			text.setEditable(true);
		}
	});
	shell.pack();
	shell.open();
	while(!shell.isDisposed()){
		if( !display.readAndDispatch()){
			display.sleep();
		}
	}
	return 0;
}
Comment 1 Ivan Furnadjiev CLA 2011-02-15 04:21:57 EST
The problem was in TextUtilLCA#writeVerifyAndModifyListener, where the property "hasVerifyOrModifyListener" was not written on the client in case of READ_ONLY style flag. Fixed in CVS HEAD.