Ajuda com tela de Splash
Bom dia
na minha tela de splash eu tenho um gauge e um label, o problema está no label. Ele deveria mostrar os módulos que deveriam ser carregados
código no form Splash
Código do arquivo POSTO.dpr
na minha tela de splash eu tenho um gauge e um label, o problema está no label. Ele deveria mostrar os módulos que deveriam ser carregados
código no form Splash
unit UntSplash;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.jpeg,
Vcl.ComCtrls, Vcl.Samples.Gauges, RxCtrls, Vcl.StdCtrls, Vcl.Imaging.pngimage;
type
TFrmSplash = class(TForm)
Gauge1: TGauge;
Image1: TImage;
RxLabel4: TRxLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Image2: TImage;
private
{ Private declarations }
public
{ Public declarations }
Procedure percorreArquivoTexto ( modulos: String );
end;
var
FrmSplash: TFrmSplash;
implementation
{$R *.dfm}
Procedure TFrmSplash.percorreArquivoTexto (modulos : String);
var arq: TextFile;
linha: String;
begin
AssignFile (arq, 'C:\\Projetos\\Posto\\Modulos.txt');
Reset (arq);
ReadLn (arq, linha);
while not Eof (arq) do
begin
Label3.Caption := linha; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< O LABEL RECEBE O VALOR SEM PROBLEMA
{ Processe a linha lida aqui. }
{ Para particionar a linha lida em pedaços, use a função Copy. }
ReadLn (arq, linha);
end;
CloseFile (arq);
end;
end.
Código do arquivo POSTO.dpr
Begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDtMdl, DtMdl);
Application.CreateForm(TDtMdlAux, DtMdlAux);
Application.CreateForm(TDtMdlWEB, DtMdlWEB);
Application.CreateForm(TFrmPrincipal, FrmPrincipal);
Application.CreateForm(TFExecao, FExecao);
Application.CreateForm(TFrmSplash, FrmSplash);
FrmSplash.Show; //Irá fazer a Tela de Splash aparecer
FrmSplash.Refresh; // Faz com que a tela atualize
Sleep(300); // Faz com que aguarde 4 segundos
frmSplash.Gauge1.Progress:= 25;
Sleep(300);
frmSplash.Gauge1.Progress:= 50;
Sleep(500);
frmSplash.Gauge1.Progress:= 75;
Sleep(300);
frmSplash.Gauge1.Progress:= 100;
Sleep(1000);
FrmSplash.percorreArquivoTexto('Modulos.txt'); <<<<<<<<<TENTO CHAMAR A PROCEDURE QUE ABRE O ARQUIVO TXT COM O NOME DOS MÓDULOS
FrmSplash.Release; // Elimina a tela depois na memória
FrmSplash := nil; // Irá anular a referencia ao ponteiro do objeto
FrmAltUsr := TFrmAltUsr.Create(Application);
if FrmAltUsr.Showmodal = mrOK then
begin
FrmAltUsr.Free;
Application.Run;
end
else
begin
FrmAltUsr.Free;
Application.Terminate;
end;
end.
Emanuel Gonçalves
Curtidas 0
Respostas
Dorivan Sousa
31/08/2016
Label3.Caption := linha; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< O LABEL RECEBE O VALOR SEM PROBLEMA
Label3.Update;
Label3.Update;
GOSTEI 0
Emanuel Gonçalves
31/08/2016
Dorivan,
Não resolveu
Não resolveu
GOSTEI 0
Emanuel Gonçalves
31/08/2016
Resolvido
Coloquei um Sleep(10); dentro do laço
Coloquei um Sleep(10); dentro do laço
Procedure TFrmSplash.percorreArquivoTexto (modulos : String);
var arq : TextFile;
linha : String;
begin
AssignFile (arq, 'C:\\Projetos\\Posto\\Modulos.txt');
Reset (arq);
ReadLn (arq, linha);
while not Eof (arq) do
begin
Sleep(12); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Label3.Caption := linha;
Label3.Update;
{ Processe a linha lida aqui. }
{ Para particionar a linha lida em pedaços, use a função Copy.}
ReadLn (arq, linha);
end;
CloseFile (arq);
end;
GOSTEI 0