|
|
Re: Combo look-and-feel on Windows 7 [message #654793 is a reply to message #653610] |
Thu, 17 February 2011 07:59 |
Roel De Nijs Messages: 28 Registered: March 2010 |
Junior Member |
|
|
Hi Grant,
I used following small code snippet to test the combo's behavior:
public class ComboTest {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("ComboTest");
shell.setLayout(new FillLayout(SWT.VERTICAL));
new Text(shell, SWT.SINGLE);
Combo combo = new Combo(shell, SWT.READ_ONLY);
combo.setItems(new String[] { "A", "B", "C" });
combo.setBackground(new Color(display, 153, 186, 243));
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
I don't see any possibility to attach some files to this topic, so I guess it's not allowed to add files to this forum (according to the help pages).
I executed this program on a Windows XP and a Windows 7 machine and took some screenshots to show the difference.
1. WinXP with XP Theme
2. WinXP with Classic Theme
3. Win7 with Win7 Basic Theme
4. Win7 with Windows Classic Theme
As you can see the combo looks different on a Win7 with Win7 basic theme (see 3rd screenshot) and the user can't see the blue-ish color (which in our application is the color to indicate a mandatory field).
I ran the code snippet with both Eclipse 3.5 (sr2) and 3.6 (sr1) and the results are the same. I also tried with a different color, but again similar results.
Kind regards,
Roel
|
|
|
Re: Combo look-and-feel on Windows 7 [message #654904 is a reply to message #654793] |
Thu, 17 February 2011 14:56 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
I see, this is for read-only Combos. This is a behaviour that comes from
the theme, so it's "correct" (see "hint" in the javadoc for
Control.setBackground()). It's not something that swt would change, and
quite possibly could not override anyways. I don't know of a workaround to
suggest to make this work, other than to change your visual cue for marking
a control as being "required".
Grant
"Roel De Nijs" <roel@javaroe.be> wrote in message
news:ijik5k$jq9$1@news.eclipse.org...
> Hi Grant,
>
> I used following small code snippet to test the combo's behavior:
> public class ComboTest {
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> shell.setText("ComboTest");
> shell.setLayout(new FillLayout(SWT.VERTICAL));
>
> new Text(shell, SWT.SINGLE);
>
> Combo combo = new Combo(shell, SWT.READ_ONLY);
> combo.setItems(new String[] { "A", "B", "C" });
> combo.setBackground(new Color(display, 153, 186, 243));
>
> shell.pack();
> shell.open();
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> }
> }
>
>
> I don't see any possibility to attach some files to this topic, so I guess
> it's not allowed to add files to this forum (according to the help pages).
>
> I executed this program on a Windows XP and a Windows 7 machine and took
> some screenshots to show the difference.
>
> 1. WinXP with XP Theme
>
>
> 2. WinXP with Classic Theme
>
>
> 3. Win7 with Win7 Basic Theme
>
>
> 4. Win7 with Windows Classic Theme
>
>
> As you can see the combo looks different on a Win7 with Win7 basic theme
> (see 3rd screenshot) and the user can't see the blue-ish color (which in
> our application is the color to indicate a mandatory field).
>
> I ran the code snippet with both Eclipse 3.5 (sr2) and 3.6 (sr1) and the
> results are the same. I also tried with a different color, but again
> similar results.
>
> Kind regards,
> Roel
|
|
|
|
Re: Combo look-and-feel on Windows 7 [message #655064 is a reply to message #653610] |
Fri, 18 February 2011 08:47 |
Roel De Nijs Messages: 28 Registered: March 2010 |
Junior Member |
|
|
We'll use CCombo to emulate a combo's behavior. It's almost as good as a native one with a big plus: the background of the ccombo (the text field) has the correct background color (even on a Windows 7 machine).
Just 2 (minor) issues in comparison with a native combo:
* because a text field is used for the emulation, it seems you can enter some text in the text field (but you can't if you use READ_ONLY style)
* with a native combo you can enter the first letter of an item and the combo will select this item, with a ccombo you can't
But we prefer showing the correct background color above these issues, so CCombo is the obvious choice (unless you would know of some big troubles using this control)
Thanks!
Roel
[Updated on: Fri, 18 February 2011 08:48] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03581 seconds