Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315689 - Text setEditable(false) changes background color unexpectedly
Summary: Text setEditable(false) changes background color unexpectedly
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-03 18:02 EDT by Elias Volanakis CLA
Modified: 2010-06-04 12:03 EDT (History)
2 users (show)

See Also:


Attachments
Snippet to reproduce issue (1.70 KB, application/octet-stream)
2010-06-03 18:04 EDT, Elias Volanakis CLA
no flags Details
Patch (2.79 KB, patch)
2010-06-03 19:13 EDT, Elias Volanakis CLA
no flags Details | Diff

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