- This topic has 6 replies, 4 voices, and was last updated 8 years, 10 months ago by Support.
-
AuthorPosts
-
December 18, 2009 at 2:59 pm #33462jonesaParticipant
Hello,
I am curious if there is a reasonable way to modify a skin at runtime. In particular, I would like to modify the background color of FORMTITLE to be user selectable in my application, so I need some way to overwrite the value from the skin when they change it.
I was looking at reaching into the gd array and trying to update it in there, but that seemed like the wrong way to do things from an API perspective..
December 22, 2009 at 7:49 am #41347SupportKeymasterHello
Sometimes title may be filled by texture or gradient and changing of color is not enough in this case.
I think, you must describe your target with more details..Maybe you must make a new skinsection inherited from 'FORMTITLE' with new properties, you can do it using the SkinManager.CommonSections property.
December 23, 2009 at 1:29 am #41355jonesaParticipantYes, so assume that I have the skins configured such that changing the color will actually work.
Is there a clean way to create a skin section at runtime with modified properties? CommonSections seems to let me create a section, but does not really explain how to modify it (nor make it inherit)… Would I need to create a new section each time I change the color? How do I specify that the new section inherits from FORMTITLE?
I have gotten this to work with this test code, but I do not think I am supposed to be modifying gd:
CODEvoid __fastcall TForm1::sColorSelect1Change(TObject *Sender)
{
int idx = sSkinManager1->GetSkinIndex(s_FormTitle);
Smaskdata::TsGeneralData &gendata = sSkinManager1->gd[idx];
gendata.Color = ((TsColorSelect *) Sender)->ColorValue;
gendata.HotColor = gendata.Color;
sSkinManager1->RepaintForms();
}December 23, 2009 at 10:14 am #41359SupportKeymasterChanging of this array of properties is not forbidden. But you must remember that all properties will be reloaded after the skin changing.
I can make a demo for dynamic changing of properties in the CommonSections property, but time is needed for it. Write me if you need this demo.December 23, 2009 at 4:05 pm #41361HeDiBoParticipantQUOTE (Support @ Dec 23 2009, 12:14 PM) <{POST_SNAPBACK}>Changing of this array of properties is not forbidden. But you must remember that all properties will be reloaded after the skin changing.
I can make a demo for dynamic changing of properties in the CommonSections property, but time is needed for it. Write me if you need this demo.Maybe it is time to start considering a more universal, implementation hiding procedure to change skin properties dynamically. Could be a very nice addition to AlphaControls.
January 11, 2016 at 7:41 pm #54578standayParticipantI'd like to see a demo on doing this the right way(!) when possible. The way I'm doing it right now is to clear the commonsections on the fly, and then add everything back in only with the new color I want in a given section. But then I have to reinit everything using sSkinManager1.SkinName := sSkinManager1.SkinName. This all works, but it's slow and the code involved is messy. I'm going to try the approach jonesa put together and see if that works better.
January 13, 2016 at 10:11 am #54589SupportKeymasterPlease. specify what you need to change in the current skin in run-time.
TitleBar color?
TitleBar may be filled by texture or gradient, so, this filling must be cancelled for using of one solid color there.
-
AuthorPosts
- You must be logged in to reply to this topic.