Idea for the skinManager component.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #38248
    JM-DG
    Participant

    Hi!

    The idea is simple.

    It would be nice to have an accessible event between “onBeforeChange” & “onAfterChange”.

    The reason is that I want to get access to some informations of the next skin being loaded, so this means after the “onBeforeChange” event;

    but before that skin gets fully loaded/updated/repaint everything, so this means before the “onAfterChange” event.

    Right now, I added a “OnChange” event just after +/- line 3132:

    Code:
    try
    ResetSkinData;
    InitCommonData;
    except
    on E: Exception do begin
    FSkinName := OldName;
    ShowError(E.Message);
    end;
    end;
    ===============
    if Assigned(FOnChange) then
    FOnChange(Self);
    ===============

    Thank you for your time.

    #59430
    Support
    Keymaster

    I will think about such event.

    #59457
    JM-DG
    Participant

    I see that the new event has been added.

    Thank you for that. 🙂

    However I thought that the event would come after the new skin information has been loaded up. +/- line 3160

    After the code:

    Code:
    ResetSkinData;
    InitCommonData;

    Example:

    Code:
    try
    ResetSkinData;
    InitCommonData;
    except
    on E: Exception do begin
    FSkinName := OldName;
    ShowError(E.Message);
    end;
    end;

    if Assigned(FOnSkinChanging) then begin
    FOnSkinChanging(Self, FSkinName);
    end;

    If not, I have to redo some of the logic in the current onSkinChanging event in order to get the color palettes of the new skin being loaded.

    Ex:

    Code:
    procedure TDataModule1.sSkinManager1SkinChanging(Sender: TObject;
    const NewSkinName: String; var AllowChanging: Boolean);
    var color:TColor;
    begin
    sSkinManager1.ManagerState := sSkinManager1.ManagerState + [msSkinChanging];
    sSkinManager1.ResetSkinData;
    sSkinManager1.CommonSkinData;
    sSkinManager1.ManagerState := sSkinManager1.ManagerState – [msSkinChanging];

    color := clNone;
    if(not IsDarkColor(sSkinManager1.GetGlobalColor)) then
    begin
    color:= sSkinManager1.GetHighLightColor(true);
    end;

    BorderIcons.BlendColor:= color;
    PlayerControls.BlendColor:= color;
    LargePlayerControls.BlendColor:= color;
    end;

    #59475
    Support
    Keymaster

    The OnSkinChanging event occurs before loading of new skin and allows to prevent loading of the skin.

    Look on the OnSkinLoading event. This event occurs when skin is loaded but not activated yet. Maybe that's what you need.

    #59480
    JM-DG
    Participant
    'Support' wrote:

    The OnSkinChanging event occurs before loading of new skin and allows to prevent loading of the skin.

    Look on the OnSkinLoading event. This event occurs when skin is loaded but not activated yet. Maybe that's what you need.

    I tried the OnSkinLoading event before and it was causing me some problem… (I can't remember what)

    However I just tried it again and everything worked fine.

    Thank you. This is what I needed.

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