views:

188

answers:

1

I am creating a component that uses a collection and collection items of panels.

I can't seem to get the colors to work at runtime, but yet they seem to work just fine at design time.

You can download the component source code here:

http://www.shaneholmes.net/pasfiles/

There is a Consoles (Tcollection) property, status colors property, and a Edit mode property

Each console (TCollectionItem) has a status property when changed, the consoles property is changed based on the components StatusColors property.

When the components EditMode property is set to true, you can move the panels around at runtime.

Question: Why does the colors only work at designtime and not runtime.

thanks

A: 

I haven't looked at your code, but "panels" + "colors not working" sounds as if you've forgotten to set ParentBackground to False.

I guess that the colors probably work at design-time, because you enabled theming by using XPMan and not by checking the "Enable run-time themes" checkbox in the project options. (The second option is only available to you, if you have D2007 or later.)

Ulrich Gerhardt
No, i have not enabled Theming....and I did try setting ParentBackground = false and it did not change the results
I just built a little app in D2006 and get colored TConsole's if the app isn't themed. As soon as I add XPMan to the project, the created consoles are gray. Adding `ParentBackGround := False;` to `TConsoleControl.Create` fixes this. So I dispute your comment. :-)
Ulrich Gerhardt
Not sure what TConsoleControl is, but I assume you are referring to TConsolePanel. I added ParentBackground=False before i posted this question, but I went back and tried it again to be sure i didn't make some mistake. I do not get the colored panels still. I am not using D2006, i am using Delphi 2010.constructor TConsolePanel.Create(AOwner: TComponent);begin inherited Create(AOwner); ParentBackground:= False; ...end;
How do i tell if the app is themed or not. Is it themed by default when i create an app? I wouldn't think it is. I dont use themes.
Ok, I just tested this in Delphi 7 and it worked. So, if it works in Delphi 7, and as you say, Delphi 2006, then there is an issue with Delphi 2010 - maybe i need to something new??????????
Re "Not sure...": How about searching for `TConsoleControl` in the unit we're talking about? :-P
Ulrich Gerhardt
Re "How do I tell...": Have a look at the checkbox I mentioned in my answer.
Ulrich Gerhardt