Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337130 - [Text] ModifyListeners are ignored when widget initially READ_ONLY
Summary: [Text] ModifyListeners are ignored when widget initially READ_ONLY
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.4 M6   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-14 09:50 EST by Rüdiger Herrmann CLA
Modified: 2011-02-15 04:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.