[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Unable to set background color of an SWT Button
|
Please add this information to the bug report but don't reopen it. This is
the same conclusion that I came to a while back.
If fixing the button requires owner draw, then we aren't really interested
at this time. Owner draw has all kinds of bad problems associated with it
that don't seem worth it. Setting the background color of a control in this
day and age is dicy anways given the advent of themes and theme managers.
"Luis" <lcrespom@xxxxxxxxx> wrote in message
news:d4nr69$ghi$1@xxxxxxxxxxxxxxxxxxx
> Hi,
>
> I have been looking both MSDN and the source code of
> org.eclipse.swt.widgets.Button and org.eclipse.swt.internal.win32.OS.
> (Link to MDSN information about Windows Buttons:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/buttons/buttontypesandstyles.asp)
>
> Apparently some buttons in windows allow for a change in the background
> color and some others don't. Specifically, only the ones of type
> "BS_OWNERDRAW" allow for that. As the name implies, the application has to
> draw the inside of the button, and that is what SWT does with arrow
buttons
> but not with the other ones.
>
> So probably fixing the bug for arrow buttons would be relatively easy,
while
> providing the same functionality for the rest of the SWT button types
would
> require a bigger change in the code. Anyway that is not a crazy idea since
> this is what .net does with all buttons.
>
> In summary: I think there is enough information to fix the bug, but the
fix
> is not a simple one. Do you think that the provided information is enough?
> Also, given the amount of work required for the fix, it may be a very
> low-priority bug...
>
> Regards,
>
> Luis.
>
>
> "Steve Northover" <steve_northover@xxxxxxxxxx> wrote in message
> news:d4iqcr$8l9$1@xxxxxxxxxxxxxxxxxxx
> > Luis, please reopen 23837 with a link to the MSDN or a patch to fix the
> > problem on Windows but don't reopen the bug report unless there is
enough
> > information to fix it. Thanks!
> >
> > "Luis" <lcrespom@xxxxxxxxx> wrote in message
> > news:d4iarq$k7t$1@xxxxxxxxxxxxxxxxxxx
> > > But wait, this bug is a bug precisely in Windows!
> > > As far as I know, the button background color DOES change in other
OSs.
> > >
> > > According to Chhil's reply:
> > > "This is currently not possible on windows and there is bug
report
> > > filed"
> > > And I have seen the bug report (id 23837), and it is reported as a
> Windows
> > > bug.
> > >
> > > Anyway, thank you for the info on the SendMessage call: I can always
> check
> > > the OS before making the call, that way my code can still be portable.
> > >
> > >
> > > "Emil Crumhorn" <crumhorn@xxxxxxxxxxxxx> wrote in message
> > > news:d4e83m$9m4$1@xxxxxxxxxxxxxxxxxxx
> > > > Unless it's doable on all platforms that SWT supports, chaning the
> > button
> > > > color won't be added even if it's doable on Windows. It doesn't
> surprise
> > > me
> > > > that C# lets you do it if it's in the windows API.
> > > >
> > > > If you don't care about cross-platform compatability for you app (or
> you
> > > > only do the needed calls if you're on Windows), you can just make
the
> > > > necessary SendMessage calls on the win32 OS api that SWT comes with.
> > > >
> > > > Here's some API info regarding themes and changing them:
> > > >
> > >
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xptheming.asp
> > > >
> > > > And a google search on "win32 changing button color" will get you
more
> > > info.
> > > >
> > > > Hope that helps,
> > > > Emil
> > > >
> > > > "Luis" <lcrespom@xxxxxxxxx> wrote in message
> > > > news:d4b589$jqs$1@xxxxxxxxxxxxxxxxxxx
> > > > > Hello,
> > > > >
> > > > > I did a quick test in C# with MS Visual Studio 2003 and I was able
> to
> > > > > change
> > > > > the background color of a Windows button:
> > > > >
> > > > > System.Windows.Forms.Button but;
> > > > > but=new System.Windows.Forms.Button();
> > > > > but.BackColor = System.Drawing.Color.Aquamarine;
> > > > >
> > > > > With the code above you can get a nice aquamarine button in
Windows.
> > > > > I am pretty sure that, unlike Swing, C# and .NET do not emulate
> > buttons
> > > > > but
> > > > > use the standard Windows ones. That is, as far as I understand,
that
> > > code
> > > > > eventually invokes the standard Windows system GUI primitives.
> > > > > So I don't understand why the bug appears as "WONTFIX"
> > > > > ....?
> > > > >
> > > > >
> > > > >
> > > > > "Chhil" <aaa@xxxxxxxxxxxxxx> wrote in message
> > > > > news:d438nb$el6$1@xxxxxxxxxxxxxxxxxxx
> > > > >> Hello Luis,
> > > > >> This is currently not possible on windows and there is bug
report
> > > filed
> > > > >> in bugzilla.
> > > > >>
> > > > >> -chhil
> > > > >> Luis wrote:
> > > > >> > Hello,
> > > > >> >
> > > > >> > I have Eclipse 3.0.1 under windows XP. I have created a simple
> SWT
> > > > >> > Shell
> > > > >> > (window), with the help of the Visual Editor Plugin.
> > > > >> >
> > > > >> > By using the setBackground(...) method, I can easily change the
> > > > >> > background of a label. But when I do the same to a button, it
> just
> > > > >> > ignores me.
> > > > >> >
> > > > >> > Is that normal? Is it a bug? A missing feature which will be
> > > available
> > > > >> > in a later version? Or is it that the OS Look and Feel prevails
> for
> > > > > this?
> > > > >> >
> > > > >> > In any case... is there a workaround for this limitation? I
could
> > > > >> > change
> > > > >> > the whole OS Look and Feel, but this is too radical, and also
in
> my
> > > > >> > application I will need to have buttons of different colors
> > depending
> > > > >> > on
> > > > >> > its functionality.
> > > > >> > The only workaround I can think of is to do like Swing does and
> > write
> > > > >> > my
> > > > >> > own button component from scratch. That looks too much like a
> brute
> > > > >> > force approach.
> > > > >> >
> > > > >> > Thanks for your help,
> > > > >> >
> > > > >> > Luis.
> > > > >> >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>