Modify skin at runtime?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #33462
    jonesa
    Participant

    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..

    #41347
    Support
    Keymaster

    Hello

    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.

    #41355
    jonesa
    Participant

    Yes, 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:

    CODE
    void __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();
    }

    #41359
    Support
    Keymaster

    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.

    #41361
    HeDiBo
    Participant

    QUOTE (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.

    #54578
    standay
    Participant

    I'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.

    #54589
    Support
    Keymaster

    Please. 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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.