Buscar

Como incrementar a barra de status

Código

{No formulário principal coloque uma statusbar com 3 panels,1 time e aplicationeventos e digite as funções abaixo }
 

function mostrahora:string;
begin
  mostrahora:=timetostr(time);
end;
function mostradata:string;
var
  dthoje:tdatetime;
  diasemana:integer;
  strdiasemana:string;
begin
  dthoje:=date;
  diasemana:=dayofweek(dthoje);
  case diasemana of
  1:strdiasemana:='Domingo';
  2:strdiasemana:='Segunda-feira';
  3:strdiasemana:='Terça-feira';
  4:strdiasemana:='Quarta-feira';
  5:strdiasemana:='Quinta-feira';
  6:strdiasemana:='Sexta-feira';
  7:strdiasemana:='Sábado';
  end;
  mostradata:=strdiasemana+' '+datetostr(dthoje);
end;
// Selecione o aplicationeventos e na guia eventos do objeto inspector depois clique no evento OnHint e digite o código ->
 
procedure TFnomedoform.ApplicationEvents1Hint(Sender: TObject);
Begin
  StatusBar1.Panels[2].Text:=Application.Hint;
  // todos os hints do seu projeto apareceram no statusbar
end;
 
// agora faça com que suas funções apareçam o resultado
 
procedure TFnomedoform.Timer1Timer(Sender: TObject);
var
  presente:tdatetime;
  ano,mes,dia:word;
begin
  presente:=now;
  decodedate(presente,ano,mes,dia);
  case mes of
  1:STATUSBAR1.PANELS[1].TEXT:=' JANEIRO '+inttostr(ano);
  2:STATUSBAR1.PANELS[1].TEXT:='FEVEREIRO'+inttostr(ano);
  3:STATUSBAR1.PANELS[1].TEXT:='MARÇO '+inttostr(ano);
  4:STATUSBAR1.PANELS[1].TEXT:='ABRIL '+inttostr(ano);
  5:STATUSBAR1.PANELS[1].TEXT:='MAIO '+inttostr(ano);
  6:STATUSBAR1.PANELS[1].TEXT:='JUNHO '+inttostr(ano);
  7:STATUSBAR1.PANELS[1].TEXT:='JULHO '+inttostr(ano);
  8:STATUSBAR1.PANELS[1].TEXT:='AGOSTO '+inttostr(ano);
  9:STATUSBAR1.PANELS[1].TEXT:='SETEMBRO '+inttostr(ano);
  10:STATUSBAR1.PANELS[1].TEXT:='OUTUBRO '+inttostr(ano);
  11:STATUSBAR1.PANELS[1].TEXT:='NOVEMBRO '+inttostr(ano);
  12:STATUSBAR1.PANELS[1].TEXT:='DEZEMBRO '+inttostr(ano);
  end;
  STATUSBAR1.PANELS[0].TEXT:=mostrahora();
  STATUSBAR1.PANELS[1].TEXT:=mostradata();
end;
 

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Forms
Adicionada dia: 18/07/03
Por: Jefferson Agostinho
Visualizada: 2335 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009