Autor Beitrag
hydemarie
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 475
Erhaltene Danke: 51



BeitragVerfasst: Di 07.01.20 00:05 
Ich habe hier mal wieder Code, der nicht so recht will ...

ausblenden Delphi-Quelltext
1:
2:
3:
StatusLabel.Caption := 'Das wird etwas dauern ...';
ArbeiteVielUndHart(); // Das blockiert das GUI - da passiert eine Menge (überwiegend Downloads über fpHttpClient), leider noch nicht im Hintergrund...
StatusLabel.Caption := 'Fertig!';


Sichtbar ist immer nur "Fertig!", der Teil davor kommt gar nicht erst auf dem Bildschirm an.
Lazarus 2.0.6, Windows 10.

Ideen? :)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10181
Erhaltene Danke: 1254

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 07.01.20 01:03 
Moin!

Hast du selbst geschrieben:
1. Theads. Das ist die Lösung.
2. Application.ProcessMessages; Das ist der Workaround.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.

Für diesen Beitrag haben gedankt: hydemarie
hydemarie Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 475
Erhaltene Danke: 51



BeitragVerfasst: Di 07.01.20 01:11 
Ah - an 2. hatte ich nicht gedacht - danke! (Getestet: Geht!)

Funktioniert synchroner HTTP-Download in einem Thread?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 07.01.20 08:57 
Wobei es meistens besser ist nur ein Repaint zu machen (Abarbeitung der Paint-Nachrichten) statt Application.ProcessMessages (alle Nachrichten abarbeiten, auch solche, die potentiell die aktuelle Aktion stören).

Ja, ein Download funktioniert normalerweise problemlos in einem Thread.

Für diesen Beitrag haben gedankt: hydemarie
OlafSt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 486
Erhaltene Danke: 99

Win7, Win81, Win10
Tokyo, VS2017
BeitragVerfasst: Di 07.01.20 10:46 
StatusLabel.Update bringts auch, aber ohne das waghalsige ProcessMessages.

_________________
Lies, was da steht. Denk dann drüber nach. Dann erst fragen.

Für diesen Beitrag haben gedankt: hydemarie