segunda-feira, 17 de junho de 2019

Alterar cor do fonte do Label Firemonkey em tempo de execucao

To enable modifying font color of a TLabel object, you need to change its StyledSettings property.
It's an array defining the different settings that are defined by the current style and cannot be changed by other means.
To be able to change the color of the font, you have to remove the TStyledSetting.FontColor entry from this array.
You can do it programmatically with
Label1.StyledSettings := Label1.StyledSettings - [TStyledSetting.FontColor];
or from the Object Inspector in the designer, select your label, go in StyledSettings and untick FontColor.
Other settings that can be fixed by the current style are
  • TStyledSetting.Family
  • TStyledSetting.Size
  • TStyledSetting.Style
  • TStyledSetting.Other
So, for being able to change the font color and the size, you would write:
Label1.StyledSettings := Label1.StyledSettings - [TStyledSetting.FontColor, TStyledSetting.Size];

sexta-feira, 14 de junho de 2019

Saber se o listview do firemonkey chegou no fim
var
  R: TRectF;
begin
  if TListView(Sender).ItemCount > 0 then // Just in case...
  begin
    // Get the last item's Rect
    R := TListView(Sender).GetItemRect(TListView(Sender).ItemCount - 1);
    // Bottom?
    if R.Bottom = TListView(Sender).Height then
      showmessage('Reached bottom');
  end;
end; 


Basta colocar no evento OnScrollViewChange do listview.