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

Bug 315689

Summary: Text setEditable(false) changes background color unexpectedly
Product: [Eclipse Project] Platform Reporter: Elias Volanakis <elias>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: christian.campo, eclipse.felipe
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Snippet to reproduce issue
none
Patch none

Description Elias Volanakis CLA 2010-06-03 18:02:53 EDT
Invoking text.setEditable(false) changes the text's visible background color (at least on Vista). This only happens if the Text has the default bg color.

Debugging through the code reveals that control.defaultBackground() returns a different value (handle) in that case.

To reproduce: use attached snippet. Press button. Notice that the first text widget changes bg color.

Expected: bg color remains unchanged. (if not fixable it should be documented)

PS: The following seems to be an ok workaround: retrieving the bg color before invoking setEditable(...) and setting in again afterwards.
Comment 1 Elias Volanakis CLA 2010-06-03 18:04:12 EDT
Created attachment 171039 [details]
Snippet to reproduce issue
Comment 2 Elias Volanakis CLA 2010-06-03 19:13:52 EDT
Created attachment 171051 [details]
Patch

Patch and test case. Please review for 2.0 / HEAD.
Comment 3 Elias Volanakis CLA 2010-06-03 19:14:52 EDT
Sorry this patch was meant for Riena.
Comment 4 Felipe Heidrich CLA 2010-06-04 09:24:04 EDT
(In reply to comment #0)
> Expected: bg color remains unchanged. (if not fixable it should be documented)

Visually the background did change from white to gray. Why do you think getBackground() should remain unchanged ?

What are you trying to do and how this behaviour is causing you trouble ?

Closing as won'f fix.
Comment 5 Elias Volanakis CLA 2010-06-04 12:03:46 EDT
I found it surprising because it is not documented and not consistent (i.e. it only happens when the bg color has not been set).

What I'm trying to do: in Riena we manage the widget background color explicitly, depending on certain framework states. This unexpected change was messing that up. 

Anyway, since I've a workaround I'm ok with WONTFIX.