Set button state manually

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #51694
    CheshireCat
    Participant

    Hello and welcome to the forum,

    you can set the Default property to true for specific buttons 🙂

    #51697
    surfer007
    Participant

    Thank you very much for the fast and perfect tip 🙂

    Is it possible to manually control the outer glow of the button, too?

    #51701
    CheshireCat
    Participant

    My first idea was to use a timer, but maybe someone has a better solution 🙂

    I use the functions Hide- and ShowGlow from the acGlow unit. You can set the time interval to a value that you need.

    Code:
    uses Windows, sCommonData, acGlow;

    procedure TForm2.sButton1Click(Sender: TObject);
    begin
    sButton1.Default := not sButton1.Default;
    end;

    procedure TForm2.Timer1Timer(Sender: TObject);
    var
    skd : TsCommonData;
    R, RBox : TRect;
    DC : hdc;
    begin
    skd := sButton1.SkinData;

    if (sButton1.Default) then
    begin
    if skd.GlowID <> -1 then HideGlow(skd.GlowID);
    if GetWindowRect(TWinControl(skd.FOwnerControl).Handle, R) then
    begin
    DC := GetWindowDC(TWinControl(skd.FOwnerControl).Handle);
    if GetClipBox(DC, RBox) = 0 then Exit;
    ReleaseDC(TWinControl(skd.FOwnerControl).Handle, DC);
    skd.GlowID := ShowGlow(R, RBox, skd.SkinSection, 'GLOW', skd.SkinManager.gd[skd.SkinIndex].GlowMargin,
    MaxByte, sButton1.Handle, skd);
    end;
    end else
    begin
    if (skd.GlowID <> -1) and not (skd.FMouseAbove) then
    begin
    HideGlow(skd.GlowID);
    skd.GlowID := -1;
    end;
    end;
    end;

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