Skinning of dynamically created controls?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34856
    ralfiii
    Participant

    If I put the following code

    Code:
    with TSpeedButton.Create(self) do
    begin
    Width:=50;
    Height:=50;
    Top:=50;
    Left:=50;
    Parent:=self;
    Caption:='xx';
    end;

    in the OnCreate-event of a form, then the button is skinned.

    If I put it into the OnClick of a button and it's performed after the OnShow has been performed, then the button is not skinned.

    I figured out I can call sSkinManager1.RepaintForms, but this creates some short animation.

    Any other way to get the skinning working here?

    (I populate some areas of a form with buttons right after the OnShow. I need to do that because the app has to show it's main form quickly even if buttons are loaded a bit later. This way the app looks faster and more responsive. So there's no real way around that)

    Thanks,

    Ralf

    #47037
    Support
    Keymaster

    Hello

    You can try this code

    Code:
    var
    sBtn : TSpeedButton;
    begin
    sBtn := TSpeedButton.Create(self);
    with sBtn do begin
    Width := 50;
    Height := 50;
    Top := 50;
    Left := 50;
    Parent := self;
    Caption := 'xx';
    end;
    sSkinProvider1.Adapter.AddNewItem(sBtn);
    end;
    #47045
    ralfiii
    Participant
    'Support' wrote:

    Hello

    You can try this code

    Code:
    sSkinProvider1.Adapter.AddNewItem(sBtn);

    As this is the main form I don't have a SkinProvider there, only a SkinManager.

    Is “Adapter” (or similar) also available from a TsSkinManager-Component?

    Or should I place a SkinProvider on the mainform also anyway? (I thought I only need SkinProvider on additional forms)

    Thanks!

    #47071
    Support
    Keymaster

    Yes, TsSkinProvider component should be placed on each form where it possible.

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