Bug 4732 - DCR - CLabel text should be grayed out when disabled (1GFMZGS)
Summary: DCR - CLabel text should be grayed out when disabled (1GFMZGS)
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P4 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Duong Nguyen CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 371524 (view as bug list)
Depends on: 22782
Blocks:
  Show dependency tree
 
Reported: 2001-10-11 14:22 EDT by Mike Wilson CLA
Modified: 2019-11-14 03:47 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wilson CLA 2001-10-11 14:22:04 EDT
DLW (6/20/2001 4:36:38 PM)
		Native label widgets often show a grayed out appearance when disabled.  I think this
		would be a very useful feature to have in CLabel.

NOTES:

	DLW (6/20/2001 4:37:25 PM)
		I have added this functionality to CLabel in my workspace.  You might want to change it 
		to add an API to set the disabled background and foreground colors, but for now, I just use 
		the native colors.

		In the method onPaint(), I have made the following change to the section where the
		text is drawn to the GC:

	// draw the text
	if (t != null) {
		int textHeight = gc.getFontMetrics().getHeight();
		Display disp = getDisplay();
		if (isEnabled()) {
			gc.setForeground(getForeground());
		} else {
			// draw the text as "grayed out"
			gc.setForeground(disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
			gc.drawText(t, x + 1, rect.y + 1 + (rect.height-textHeight)/2, true);
			gc.setForeground(disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
		}
		gc.drawText(t, x, rect.y + (rect.height-textHeight)/2, true);
	}

		In addition, I added the following method so that the text is repainted when the
		enablement is changed:


/*
 * Set the label's enablement to <code>enabled</code>.
 * Redraw the widget so the text gets redrawn to reflect the new value.
 */
public void setEnabled(boolean enabled) {
	if (enabled != isEnabled()) {
		super.setEnabled(enabled);
		redraw();
	}
}

SN (6/20/01 5:06:12 PM)
	This "(enabled != isEnabled())" is wrong.  It should be "(enabled != getEnabled())"
	or don't even do the test, just redraw.  The "draw disabled" code is also Windows
	specific ... but given that we don't have any API to support drawing text disabled,
	there's not much we can do right now (this API exists for Images).

DLW (6/21/2001 3:30:50 pm)
	How is it Windows specific?  Those constants not available on other SWT flavors.
	Or are you saying it b/c other platforms don't "gray out" their labels when disabled?
	Or that they don't have an "etched" appearance?

	McQ (26/06/2001 9:13:35 AM) -
		VI just mentioned that you are using this to do the AWT label. You need to
		watch out when using the "custom" widgets in the AWT implementation. The
		Eclipse team gets to decide what the L&F of the custom widgets is. This
		could cause you grief if they decide to change it radically.

	DLW (6/27/2001 4:56:16 pm)
		It would be helpful if the comment for getEnabled() vs. isEnabled() explained the
		difference between the two, and when you would use one vs. the other.  Currently 
		they have an identical comment.
Comment 1 DJ Houghton CLA 2001-10-29 16:34:32 EST
PRODUCT VERSION:
	Build 112

Comment 2 Steve Northover CLA 2002-08-23 11:20:35 EDT
The comment for isEnable and getEnabled has been fixed.

On some platforms, a disabled label draws the text stippled.  On others, it 
changes the text color to gray.  Other widgets, like the Windows single line 
text control, change the background to gray.

Assigning to VI.  She can decide what to do.  My vote, nothing.
Comment 3 Veronika Irvine CLA 2002-08-23 12:12:12 EDT
Waiting for 22782 to be fixed.
Comment 4 David Pickens CLA 2005-04-20 15:02:12 EDT
This should be considered a bug, not just an enhansement request. I resorted to
using CLabel instead of Label so that I could have Border support, but now
setEnabled(false) no longer grays it out! Thus, the behaviour differs from
"Label", and, therefore, is not a compatible replacement.
Comment 5 Steve Northover CLA 2007-06-11 11:33:51 EDT
Since drawing disabled is controlled by the theme manager, we shouldn't add a disabled color or change the background.  The theme manager decides what to do.
Comment 6 Felipe Heidrich CLA 2012-02-15 11:10:16 EST
*** Bug 371524 has been marked as a duplicate of this bug. ***
Comment 7 Thomas Singer CLA 2012-02-15 13:45:07 EST
Wow, a more than 10 year old RFE!
Comment 8 Lars Vogel CLA 2019-11-14 03:47:24 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.