Compila, mas não funciona!

19/04/2013

0

Compila, aparece o form de splash, porém não carrega a imagem pra dentro do form.
Gostaria de saber o que mudar.

procurei no google e achei um pessoal falando pra usar Tpicture no lugar de TImage...
Já testei e continuou na mesma.

desde já agradeço as idéias que surgirem.
Obrigado!

****************************************************************************************
unit Uconexao;

interface
uses
Variants, Classes, Graphics, Controls, ExtCtrls, Windows, Messages, SysUtils, IniFiles, DB, IBCustomDataSet, Dialogs, IBQuery, IBDatabase,
DBClient, Provider, Usplashs, IBScript, forms;


type Tconexao = class
protected
public
constructor conectar(ib:TIBDataBase; T:TIBTransaction);
destructor fim;
procedure splash(); virtual;
end;

implementation


destructor tconexao.fim;
begin

end;

constructor tconexao.conectar (ib:TIBDataBase; T:TIBTransaction);
var ArquivoINI : TIniFile;
str_server,str_path,str_filename,str_protocol :string;
begin
splash();


try

ib.Connected:=false;
ArquivoINI := TIniFile.Create(ExtractFilePath(Application.ExeName)+ '\Config.ini');
str_server := ArquivoINI.ReadString('NET','SERVER','');
str_protocol := ArquivoINI.ReadString('NET','CONNECTION_PROTOCOL','');
str_path := ArquivoINI.ReadString('FIREBIRD','SERVER_PATH','');
str_filename := ArquivoINI.ReadString('FIREBIRD','FILE_NAME','');
if str_protocol = 'TCP/IP' then
ib.DatabaseName := str_server+':'+str_path+str_filename;
if str_protocol = 'NETBEUI' then
ib.DatabaseName := '\\'+str_server+'\'+str_path+str_filename;
if str_protocol = 'SPX' then
ib.DatabaseName := str_server+'@'+str_path+str_filename;
if str_protocol = 'LOCAL' then
ib.DatabaseName := str_path+str_filename;
ib.Connected:=true;
t.StartTransaction;
except
ShowMessage('Erro de conexão com o banco: ' + str_path + str_filename);
end;


end;

procedure tconexao.splash();
var
janela_splash : TForm;
imagem: TImage;
begin
inherited Create;
janela_splash := tform.create(nil);
imagem:= TImage.create(janela_splash);
janela_splash.Position:= poScreenCenter;
imagem.Stretch:=true;
imagem.Width:=300;
imagem.Height:=200;
imagem.picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'\img\processandoinformacoes.bmp' );
imagem.Top:= 100;
imagem.Left:=100;
imagem.AutoSize:= true;
imagem.BringToFront;
imagem.Visible:=true;
janela_splash.Show;
sleep(1200);
end;



end.
Adib Valentim

Adib Valentim

Responder

Posts

19/04/2013

Rafael Cunha

Tenta colocar o seguinte comando depois do show.

janela_splash.Update
Responder

19/04/2013

Adib Valentim

coloquei e não funcionou, carrega o form sem a imagem.
Responder

22/04/2013

Adib Valentim

alguém sugere algo mais ?
Responder

22/04/2013

Joel Rodrigues

Adicione:
imagem.Parent := janela_splash;

Depois do Create.
Veja no que da.
Responder

22/04/2013

Adib Valentim

RESOLVIDO.

coloquei o seu parent, vi uma vídeo-aula no youtube que me abriu a cabeça pra umas coisas.
e por final trabalhei tudo de uma forma total com ---> with
ficou assim:

inherited Create;
janela_splash := tform.create(nil);
janela_splash.Position:= poScreenCenter;
imagem:= TImage.create(janela_splash);
janela_splash.Update;
janela_splash.Caption:= 'Futtura Softwares';
janela_splash.Show;
with imagem do begin
parent:= janela_splash;
Width:=300;
Height:=200;
Top:= 10;
Left:=10;
Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+'img\processandoinformacoes.bmp' );
Update;
Stretch:=true;
AutoSize:= true;
BringToFront;
Visible:=true;
end;
imagem.Show;
sleep(1200);


----- e o vídeo que vi e falei : http://www.youtube.com/watch?v=UyDqH5wrhxg ------
Responder

22/04/2013

Adib Valentim

classe completa

unit Uconexao;

interface
uses
Variants, Classes, Graphics, Controls, ExtCtrls, Windows, Messages, SysUtils, IniFiles, DB, IBCustomDataSet, Dialogs, IBQuery, IBDatabase,
DBClient, Provider, Usplashs, IBScript, forms;


type Tconexao = class
protected
public
constructor conectar(ib:TIBDataBase; T:TIBTransaction);
destructor fim;
procedure splash(); virtual;
end;

implementation


destructor tconexao.fim;
begin

end;

constructor tconexao.conectar (ib:TIBDataBase; T:TIBTransaction);
var ArquivoINI : TIniFile;
str_server,str_path,str_filename,str_protocol :string;
begin
splash();


try

ib.Connected:=false;
ArquivoINI := TIniFile.Create(ExtractFilePath(Application.ExeName)+ '\Config.ini');
str_server := ArquivoINI.ReadString('NET','SERVER','');
str_protocol := ArquivoINI.ReadString('NET','CONNECTION_PROTOCOL','');
str_path := ArquivoINI.ReadString('FIREBIRD','SERVER_PATH','');
str_filename := ArquivoINI.ReadString('FIREBIRD','FILE_NAME','');
if str_protocol = 'TCP/IP' then
ib.DatabaseName := str_server+':'+str_path+str_filename;
if str_protocol = 'NETBEUI' then
ib.DatabaseName := '\\'+str_server+'\'+str_path+str_filename;
if str_protocol = 'SPX' then
ib.DatabaseName := str_server+'@'+str_path+str_filename;
if str_protocol = 'LOCAL' then
ib.DatabaseName := str_path+str_filename;
ib.Connected:=true;
t.StartTransaction;
except
ShowMessage('Erro de conexão com o banco: ' + str_path + str_filename);
end;


end;

procedure tconexao.splash();
var
janela_splash : TForm;
imagem: TImage;
begin
inherited Create;
janela_splash := tform.create(nil);
janela_splash.Position:= poScreenCenter;
imagem:= TImage.create(janela_splash);
janela_splash.Update;
janela_splash.Caption:= 'Futtura Softwares';
janela_splash.Show;
with imagem do begin
parent:= janela_splash;
Width:=300;
Height:=200;
Top:= 10;
Left:=10;
Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'img\processandoinformacoes.bmp' );
Update;
Stretch:=true;
AutoSize:= true;
BringToFront;
Visible:=true;
end;
sleep(1200);

end;



end.
Responder

22/04/2013

Joel Rodrigues

Beleza, amigo. Faltava só o parent mesmo.
Então estou marcando este tópico como Concluído
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar