listar horas em um checklistbox no delphi
Boa tarde , gostaria de listar as horas em um checklistbox (pode ser outro) no delphi
a ideia é que fique assim
06:00:00 - 06:59:59
07:00:00 - 07:59:59
08:00:00 - 08:59:59
....
20:00:00 - 20:59:59
e eu possa selecionar um ou mais de um intervalos
a ideia é que fique assim
06:00:00 - 06:59:59
07:00:00 - 07:59:59
08:00:00 - 08:59:59
....
20:00:00 - 20:59:59
e eu possa selecionar um ou mais de um intervalos
Emanuel Gonçalves
Curtidas 0
Respostas
Emanuel Gonçalves
11/05/2020
resolvido
for I := 6 to 21 do
begin
x := inttostr(i);
if Length(x) = 1 then
CLHoras.Items.Add(''0''+inttostr(i)+'':00:00 - ''+''0''+inttostr(i)+'':59:59'')
else
CLHoras.Items.Add(inttostr(i)+'':00:00 - ''+inttostr(i)+'':59:59'')
end;
for I := 6 to 21 do
begin
x := inttostr(i);
if Length(x) = 1 then
CLHoras.Items.Add(''0''+inttostr(i)+'':00:00 - ''+''0''+inttostr(i)+'':59:59'')
else
CLHoras.Items.Add(inttostr(i)+'':00:00 - ''+inttostr(i)+'':59:59'')
end;
GOSTEI 0
Emerson Nascimento
11/05/2020
tente assim:
var
i: integer;
x: string;
begin
CLHoras.Clear;
for i := 6 to 21 do
begin
x := FormatFloat('00',i);
CLHoras.Items.Add(x+':00:00 - '+ x+':59:59');
end;
end;
GOSTEI 0
Emanuel Gonçalves
11/05/2020
tente assim:
var
i: integer;
x: string;
begin
CLHoras.Clear;
for i := 6 to 21 do
begin
x := FormatFloat('00',i);
CLHoras.Items.Add(x+':00:00 - '+ x+':59:59');
end;
end;
obrigado pela dica, seu código ficou mais limpo
GOSTEI 0