Link to home
Start Free TrialLog in
Avatar of sbondalapati
sbondalapatiFlag for India

asked on

Problem with TlistView.Repaint

I used Tlistview Control  and Tlistitem to display items.But i am not getting the items displayed properly.
var
  varListItem: TListItem;

begin
  varListItem         := lvSteps.Items.Add();
  varListItem.Caption := DateTimeToStr(Now);
  varListItem.SubItems.Add(AStepMessage);
  varListItem.ImageIndex := AImageIndex;
  varListItem.MakeVisible(false);
  lvSteps.Repaint();

Open in new window

Avatar of KarlisB
KarlisB
Flag of Latvia image

can you describe what you mean with " not getting the items displayed properly".
maybe a screen-shot?
Avatar of sbondalapati

ASKER

after repaint its showing blank listview.
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
move the MakeVisible line down

var
  varListItem: TListItem;
begin
  lvSteps.Items.BeginUpdate;
  try
    varListItem         := lvSteps.Items.Add;
    varListItem.Caption := DateTimeToStr(Now);
    varListItem.SubItems.Add(AStepMessage);
    varListItem.ImageIndex := AImageIndex;
  finally
    lvSteps.Items.EndUpdate;
  end;
  varListItem.MakeVisible(false);
thanks