Bug 99967 - [Forms] Section title does not use section foreground
Summary: [Forms] Section title does not use section foreground
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.1 RC3   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish
Depends on:
Blocks:
 
Reported: 2005-06-14 10:31 EDT by Qian Z. Wang CLA
Modified: 2005-06-14 14:59 EDT (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 Qian Z. Wang CLA 2005-06-14 10:31:21 EDT
In 3.1RC1, Set the section foreground to a color other than black.  Rollover the
title and it's rendered in the correct foreground color, but when the mouse
exits, the title color reverts to black.  Problem seems to be in the mouse exit
part of the title label's listener.

From ExpandableComposite.java lines 608-615:

...
case SWT.MouseExit:
  if (toggle != null) {
    label.setForeground(null);  // * Problem code
    toggle.hover = false;
    toggle.redraw();
  }
  break;
}
...

The label's foreground is set to null instead of the expected
label.setForeground(super.getForeground());

A workaround is to use the Section.FOCUS_TITLE style when creating the section
which will use a hyperlink instead of a label and the foreground is set correctly.
Comment 1 Dejan Glozic CLA 2005-06-14 14:41:41 EDT
Correct. BTW, a call to 'super' is not good - what it should be is:

label.setForeground(getForeground());

which is consistent with 'setForeground(Color)' of the class:

	public void setForeground(Color fg) {
		super.setForeground(fg);
		if (textLabel != null)
			textLabel.setForeground(fg);
		if (toggle != null)
			toggle.setForeground(fg);
	}

Mazen, can you approve this change? The fix is trivial and localized, and is a 
nice polish item.

Comment 2 Mazen Faraj CLA 2005-06-14 14:49:15 EDT
looks simple enough. a thumbs up from me. 
Comment 3 Dejan Glozic CLA 2005-06-14 14:59:26 EDT
yup, calling 'setForeground(null)' will make Label use the default widget 
foreground, which cancels the setting made in 
ExpandableComposite.setForeground'.

Done.