Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

Delphi clock in listview

I have a listview component on a form and would like one of the columns to be a clock counting down to zero.

Does anyone know how I can do this?
0
alanrogerson2
Asked:
alanrogerson2
1 Solution
 
mikelittlewoodCommented:
Would this be a different clock for every item in the listview?
0
 
Geert GruwezOracle dbaCommented:
put a timer on your form which has the ListView

in the OnTimer event change the value of the CountDown
and update the ListView

type
  TForm1 = class(TForm)
  private
    fCountDown: integer;
  end;
 
procedure TForm1.Timer1OnTimer(Sender: TObject);
begin
  if CountDown > -1 then
  begin
    CountDown := CountDown - 1;
    ListView1.Items.Item[0].SubItems[1] := IntToStr(CountDown);
  end else Timer1.Enabled := False;
end;
0
 
alanrogerson2Author Commented:
That's worked.. thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now