Community
Participate
Working Groups
Build Identifier: 3.7m3 On my Mac (OSX 10.6.6), when I select a row in a table the background of the selected row is dark blue and the text is white. However, these are not the colors returned by Device.getSystemColor(). The example below shows a light-blue color when it should be dark-blue. Reproducible: Always Steps to Reproduce: import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class TestColor { public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(300, 300); shell.setBackground(display.getSystemColor(SWT.COLOR_LIST_SELECTION)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
StyledText is using COLOR_LIST_SELECTION as the color of the text selection background color. It's an unfortunate selection of a constant name -- COLOR_TITLE_BACKGROUND is the color you are describing in this example. There's no way we can change COLOR_LIST_SELECTION, unfortunately. What are you trying to do with the color?
Hi Scott - I'm listening for an EraseItem event and drawing the row text color depending on whether it is ticked. See here for an example on Windows Vista: http://www.solaraccounts.co.uk/images/screenshots/reconcile.jpg My workaround is to define my own constants: int COLOR_LIST_SELECTION = isMac ? SWT.COLOR_TITLE_BACKGROUND : SWT.COLOR_LIST_SELECTION; int COLOR_LIST_SELECTION_TEXT = isMac ? SWT.COLOR_WHITE : SWT.COLOR_LIST_SELECTION_TEXT; I can understand if you cannot change the constant name. Perhaps the javadoc for SWT.COLOR_LIST_SELECTION could mention this problem? It currently says: "System color used to paint list selection background areas"
Created attachment 184956 [details] Example list that uses the workaround I mentioned
Added Felipe and Silenio for commentary. I think updating the javadoc is a good first start; maybe in the longer term we need additional system color constants? I agree it's not clear at all that COLOR_LIST_SELECTION is the selected text background color.
I'd argue that the javadoc is correct. As in COLOR_LIST_SELECTION and COLOR_LIST_SELECTION_TEXT are the backgroung/foreground colors that org.eclipse.swt.widgets.List use to draw a select item. You can argue that the RGB values for these constants are wrong on cocoa (COLOR_LIST_SELECTION is not the background color of a selected item in the List). But as Scott said, changing this value would break StyledText that depends on the current value. Silenio, do you think we need new constants (for selected text) ?
We would have to add four new constants: COLOR_TEXT_FOREGROUND COLOR_TEXT_BACKGROUND COLOR_TEXT_SELECTION COLOR_TEXT_SELECTION_TEXT And change StyledText to use the new constants. We would probably break any other custom editor because COLOR_LIST_SELECTION would be different on Mac. Note that this is realy open ended in the new world of themes.
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.
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. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. 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. -- The automated Eclipse Genie.