Community
Participate
Working Groups
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.
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.
looks simple enough. a thumbs up from me.
yup, calling 'setForeground(null)' will make Label use the default widget foreground, which cancels the setting made in ExpandableComposite.setForeground'. Done.