Autor Beitrag
Kaspar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mi 29.10.08 20:27 
Hallo

Ich habe ein dummes Anfängerproblem, welches mich mich allmählich zur verzweiflung bringt. Hoffe Ihr helft mir trotz meiner geringen Erfahrung weiter :-).

Also folgend der Code:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm2.Button1Click(Sender: TObject);

var
lStream: TFileStream;
begin
label1.visible:=true;
lStream:=TFileStream.Create('C:\Datei.jpg', fmCreate or fmShareDenyNone);
try 
   idHTTP1.Get('http://meineseite.org/meinbild.jpg', lStream);
finally
   lStream.Free; 
end;
Image1.Picture.LoadFromFile('C:\Datei.jpg');
label1.visible:=true;
end;


Das Problemm ist nun, dass das lablel1 erst auf visible gesetzzt wird wenn das bild fertig geladen wird. Ich mochte aber for dem Download auf Visible, sozusagen als "Ladeanzeige". Habt Ihr eine Idee warum das erst nach dem Download ausgeführt wird?
Vielen Dank im Voraus!

Gruss Kaspar

Moderiert von user profile iconGausi: Quote- durch Delphi-Tags ersetzt
LexXis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 170
Erhaltene Danke: 3



BeitragVerfasst: Mi 29.10.08 21:06 
Schau dir dazu mal die OnWork*-Ereignisse von TidHTTP an, sollte das sein was du suchst.

mfg
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mi 29.10.08 21:35 
Hallo LexXis,

Vielen Dank für deine Antwort. Habs wiefolgt eingebaut:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm2.IdHTTP1Work(ASender: TObject; AWorkMode: TWorkMode;
  AWorkCount: Integer);
begin
label1.visible:=true;
end;


Leider wird das nun erst ausgeführt wenn der Download beender ist.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Mi 29.10.08 22:11 
Der Status des Labels wird zwar verändert, aber es wird nicht neu gezeichnet. Füge ein Application.ProcessMessage direkt nach dem Anzeigen des Labels ein, dann müsste das klappen.

(Als Alternative zu Visible := True kannst du auch Show verwenden. Ist schneller geschrieben und vor allem übersichtlicher.)
Kaspar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 42



BeitragVerfasst: Mi 29.10.08 22:56 
Hallo,

Hat wunderbar geklappt mit Application.ProcessMessages; und .show.

Vielen Dank!