Detecting skin change in DLL frame

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #32967
    xeper
    Participant

    Hi,

    How exactly do I detect that the global (EXE) skin has changed in a DLL?

    I have a complex application, that uses a lot of frames from DLLs. Controls in those frame react properly, but I do regretfully have some TCharts also. And while I finally managed to make them look like something (marks/legend colors were particulary painful), I have no way of updating TChart colors when skin changes.

    After some experimentation I overriden WndProc of all those frames ancestor so it fires my own event:

    CODE
    if (Message.Msg = SM_ALPHACMD) And (Message.WParamHi = AC_GETSKINSTATE) then
    SkinChanging; //
    Inherited;

    But this is obviously lame, since this AC_GETSKINSTATE is send twice when skin changes. So?

    TIA

    Michal

    PS. SkinManager.AfterChange is not a viable solution.

    #39260
    Support
    Keymaster

    Hello
    You can catch the SM_ALPHACMD message with AC_REFRESH parameter which gets in form WndProcedure (AC_GETSKINSTATE used for other purposes).
    Can you do that?

    #39284
    xeper
    Participant

    QUOTE (Support @ May 18 2009, 08:51 AM)
    Can you do that?

    I can, but it doesn't work: the one and only message that ever gets through (to frame's WindProc) is this AC_GETSKINSTATE. I don't get AC_REFRESH at all.

    Maybe it is so because the Frame is created with nil Owner? But controls on frame do work regardless… TsFrameProvider is created dynamically (in Create).

    WndProc looks like that

    CODE
    public
    procedure WndProc (var Message: TMessage); override;

    procedure TfrBaseMBS.WndProc(var Message: TMessage);
    begin
    // FIXME doesn't work too good: some skins never fire that; it is fired twice + when destroying
    if (Message.Msg = SM_ALPHACMD) And (Message.WParamHi = AC_GETSKINSTATE) then // AC_REFRESH doesn't work
    if Not (csDestroying in ComponentState) then begin
    SkinChanging;
    MessageBeep(MB_ICONASTERISK) // DEBUG
    end;
    inherited;
    end;

    I also noticed that AC_GETSKINSTATE sometimes doesn't fire at all: eg. when switching from 'Cold” to “Elegant” (works for “Gray Plastic”);

    Thanks anyway 🙂

    PS. I need a break. I end natural language sentences with “;”… 😀

    #39338
    Support
    Keymaster

    Hi again
    If you send me a project with example then I'll try to find a best solution and problem will be solved I think

    #39397
    xeper
    Participant

    Yo,

    I tried, but it's not so easy to replicate me thinks … Simple project works, and since I cannot send you my actual one, it's kinda hopeless. I did manage though: defined app-wide global interface to skinmanager which pings its clients when change occurs.

    Regards

    M.

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