Delphi: XP Themes causing problems

Started by
12 comments, last by Riis 18 years, 2 months ago
Language: Delphi Compiler: Delphi 2005 ------- I'm working on a small program in Delphi. But i've now faced some problems i've never thought of after I tried the program on another computer. I'm using the classic theme myself and here everything is just fine. But when switching to another theme (for example the XP-theme) it's quite a different story. Two quick examples: XP Theme Classic Theme As you see above the grey color is not the same - and the scrollbar has changed style to. I've seen even more extreme cases where the button keeps the grey color, but the background is totally white. It looks - well - very bad. Is there any way I can solve this? I don't care about the blue "border" the XPTheme is making (see examples). I just want to be sure that the places I choose to be grey stay grey - nomatter what theme the user has on his desktop. Thanks in advance, Søren [Edited by - Riis on February 2, 2006 10:16:48 AM]
Søren RiisDenmark
Advertisement
Quote:I just want to be sure that the places I choose to be grey stay grey - nomatter what theme the user has on his desktop.

if you're going to specify any of the colors, specify ALL OF the colors... text colors, background colors, everything.

I have my text set to purple on grey, and if you decide to change your text to grey for some reason without considering what I may have set behind it... well, I'm not going to be very happy.

though, I can't tell you how to specify the colors in delphi
[and as a user, I'd much rather you didn't specify colors at all]


why might you want to set a particular button grey?
I work in delphi 2006 and have used 2005 before this. I'm not sure what exactly your problem is because I've never ran into problems with my color themes before. Its just the differences of the themes window colors and settings its the way windows works its not really a delphi thing in my opinion.

You could specify the colors using the color properties on the left side in the object inspector using non default colors it has settings for windows based colors that I'm guessing work with themes so when a themes color changes the actual window will change with the theme or you can tell it to do colors of your choice that won't change with the themes. Instead of using clBtnFace you could use clMidGrey or whatever you want as long as its not buttonface or window or anything that would be more windows based names for colors.
I'll try to be abit more specific.
It's not my intension to "force" a specific color. But as you will see later in this post I have some seriours color-problems, so I thought forcing the colors was a solution :)

First a part of the program. This is how it looks on my computer (classic theme) and how it was supposed to look:
From my own computer

Here are examples of how the exact same program looks on other computers (with other themes):




Again the exact same program - just a even more extreme case:

Notice that the text next to the editboxes is completely invisible. Same about the groupbox-caption.

How do I solve this?
Søren RiisDenmark
Quote:Original post by Riis
Again the exact same program - just a even more extreme case:

Notice that the text next to the editboxes is completely invisible. Same about the groupbox-caption.

How do I solve this?


One simple solution would be to set the font color of the Label to something like clBtnHighlight, or clbtnText,(IE a color that should always contrast with the color of the label) since the label's background color by default is set to clBtnFace.

This would cause the labels to look normal on classic themes, and use contrasting colors on other themes.

Of course, you still have the problem if they have both the controls background color and Highlight or text color set to the same color. But if that's the case, all of their other programs will exhibit the same behavior, and won't stay that way for long.
I use C++ Builder to develope my own software and have run into the same problem. Instead of using the built in color constants, like clBtnFace, use actual Hex values. Just double click in the color combobox and bring up the color wheel.

Doing it this way will always retain the colors you chose no matter what computer or theme the software is run on.
Author Freeworld3Dhttp://www.freeworld3d.org
Quote:Original post by oconnellseanm
I use C++ Builder to develope my own software and have run into the same problem. Instead of using the built in color constants, like clBtnFace, use actual Hex values. Just double click in the color combobox and bring up the color wheel.

Doing it this way will always retain the colors you chose no matter what computer or theme the software is run on.
Wont that cause troubles when trying to change the color on TButton, TComboBox, TPageControl and scrollbars?
They don't, as far as I can see, have the option of changing the colors?

Søren RiisDenmark
Quite frankly, if the user chooses both their windows background colour and text colour to be black, they are stupid, and don't deserve to be using a computer.

But that's besides the point- what you should do is either set EVERYTHING yourself, or set EVERYTHING to be the system default, for the very good reason that sit pointed out. Otherwise there's no way to guarantee contrasting colours. Personally I'd opt for system colours, I hate it when apps try to implement their own style that isn't necessarily the same as my own (most notably, XP theme-alikes, they look terrible when in a windows classic environment with their stupid fat buttons).
Quote:Original post by Riis
Again the exact same program - just a even more extreme case:

Notice that the text next to the editboxes is completely invisible. Same about the groupbox-caption.

How do I solve this?
You Don't! Plain and simple!
It's not your problem. It's the users problem. If they set up stupid colours, then most apps are going to have the same problem as yours.
If you hard code the color you be more unpopular than if people can change it, an they set it to something stupid. At least in the later you can blame them!
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Did I not answer this in my post...its exactly what I said. Sorry if I wasn't clear enough but yeah its the users problem and they are stupid if they set their colors to stupid colors like that knowing the app is going to do that. Changing colors like that can even render text on websites to not display correctly when set to default colors.

This topic is closed to new replies.

Advertisement