Set button state manually

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #36073
    surfer007
    Participant

    How can i set the button state manually? For example set button to normal state or to illuminated state (like mouse over). See attached pictures of the two states. I want to do a keypad, the user can select out of 9 buttons, and the selected button shall become illuminated and show it is the selected one. I could go with pure graphics, but using skins for this would be cool.

    #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 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.