[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Button in SWT and AWT

As I understand it, it's a limitation in Windows XP.  SWT uses the latest heavyweight API from Windows.  AWT is a couple years out of date.  You'll notice that AWT doesn't support Luna, while SWT does (at least, with a manifest).  My understanding is that Luna native buttons don't support background colors.  So, for SWT to support background colors in its buttons, it would have to be able to dynamically swap out the latest native button and replace it with an old one.  A real pain to say the least.

As an example of my statement on Luna buttons with background colors, write yourself an HTML page with a <input type="button"/> and change the background color.  You'll notice that the style goes from the nice rounded XP button to the traditional block style.  

If you really need the native button in SWT, you have two options.  First, you could embed an AWT button in your SWT composite using SWT_AWT.  Second, you could extend org.eclipse.swt.widgets.Button and implement your own native logic for Windows to implement the bgcoloring.  The second solution is cleaner, but much harder.  Honestly, I would go with the first.  Though, be aware that you probably break compatibility with MacOS X at that point.  But, mac os x doesn't support background coloring in buttons at all so it doesn't matter. :-)