Recent

Author Topic: ListView AdvancedCustomDrawItem Font.Color Error  (Read 2948 times)

Fatih KILIÇ

  • New Member
  • *
  • Posts: 23
ListView AdvancedCustomDrawItem Font.Color Error
« on: May 01, 2014, 06:22:45 pm »
Hi.

My ListView object has 1 column

When I click Button1 first, Test is showed in ListView with Red Color.
When I click Button1 second and other times, texts not showed in ListView and scroll bar is blinking

Note: When I run this code on Windows 7, everything is ok.

Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
  var
  li : TListItem;
begin

  li := ListView1.Items.Add;
  li.Caption := 'Test';
end;

Code: [Select]
procedure TForm1.ListView1AdvancedCustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
  var DefaultDraw: Boolean);
begin

  if(Item.Index = 0) then Sender.Font.Color := clRed;
  if(Item.Index = 1) then Sender.Font.Color := clBlue;
  if(Item.Index = 2) then Sender.Font.Color := clYellow;
end;

My System is: Kubuntu 14.04, Lazarus 1.2.2, FPC: 2.6.4

 

TinyPortal © 2005-2018