Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS FMX UI Pack
TMSFMXSpeedButton: How to change the Pressed Color

You can use the following code to to change the Pressed Color in TMSFMXSpeedButton:

procedure TForm1.TMSFMXSpeedButton1ApplyStyleLookup(Sender: TObject);
var
  I: Integer;
  c: TFMXObject;
  txt: TText;
  ca: TColorAnimation;
begin
  txt := TMSFMXSpeedButton1.GetText;
  txt.Color := claWhite;

  c := TMSFMXSpeedButton1.GetBackGround;
  for I := 0 to c.ChildrenCount - 1 do
  begin
    if c.Children[I] is TColorAnimation then
    begin
      ca := (c.Children[I] as TColorAnimation);
      if ca.Trigger = 'IsMouseOver=true;IsPressed=true' then
      begin
        ca.StartValue := claBlue;
        ca.StopValue := claGreen;
      end;
      if ca.Trigger = 'IsMouseOver=true;IsPressed=false' then
      begin
        ca.StartValue := claNull;
        ca.StopValue := claRed;
      end;
    end;
  end;
end;