Autor Beitrag
Jojojoxx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mi 22.08.07 12:35 
Hallo!

Ich habe bei meinem Programm eine Prozedur, die i.d.R. 4-5 sek. braucht um komplett durchzulaufen. Dabei werden unter anderem Daten aus dem Internet gezogen (per IdHTTP). Leider ist während dieser zeit das Progamm nicht wirklich "flüssig" bedienbar, was aber nicht an einer Überforderung der Rechenleistung oder so liegt. Lassen sich irgendwie die Bedienbaren Elemente während einer Prozedur "bedienbar" halten?
Ich hoffe die Beschreibung meines Problems ist verständlich :( Ist nur irgendwie schwer zu erklären...
mfg

Jojo
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 22.08.07 12:38 
ausblenden Delphi-Quelltext
1:
Application.ProcessMessages;					

Funktioniert zumindest in For-Schleifen.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 22.08.07 12:46 
Meines Wissens bieten die Transfer-Routinen eine CallBack-Möglichkeit. Damit kannst Du dann die "Flüssigkeit" Deines Programms herstellen. Musst mal ein bisschen im Forum suchen. Das letzte mal, dass ich mit Callbacks gearbeitet habe, ist schon ein paar Jahre her. :?
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mi 22.08.07 12:58 
Hi!
Danke für eure Antworten!
@Regan: Stimmt! An den Befehl kann ich mich jetzt auch wieder erinnern. Leider zeigt er bei mir nicht die gewünschte Wirkung :(

@jasocul: Callback sagt mir leider gar nix! :(

mfg

Jojo
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 22.08.07 13:08 
lagere doch einfach deine Proc in einen Thread aus

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
pigfacejoe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 332
Erhaltene Danke: 1

Win 10, Ubuntu
Delphi,Javascript, PHP, Java, Python
BeitragVerfasst: Mi 22.08.07 13:48 
Hi,
ich machs immer so:
idAntiFreeze Kompo aus der Sparte Indy Misc aufs Formular,
IdleTimeout auf 1 und OnlyWhenIdle auf false,
sollte klappen
//Edit: Das mit Application.ProcessMessages würde ich in deinem Fall ins OnWork Event vom IdHTTP setzen
Gruss
PigfaceJoe
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mi 22.08.07 14:06 
Hi!

Danke, mit der IdAntiFreeze Komponente läufts schon viel besser :)
Aber ist die Eingabe von "IdleTimeOut" auf "1" nicht überflüssig wenn OnlyWhenIdle auf false ist?
mfg

Jojo
pigfacejoe
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 332
Erhaltene Danke: 1

Win 10, Ubuntu
Delphi,Javascript, PHP, Java, Python
BeitragVerfasst: Mi 22.08.07 14:15 
Hmm, weiss ich ehrlich gesagt nicht genau, probier's doch mal aus ;-)
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 22.08.07 16:33 
Moin!

user profile iconJojojoxx hat folgendes geschrieben:
Ich habe bei meinem Programm eine Prozedur, die i.d.R. 4-5 sek. braucht um komplett durchzulaufen. Dabei werden unter anderem Daten aus dem Internet gezogen (per IdHTTP). Leider ist während dieser zeit das Progamm nicht wirklich "flüssig" bedienbar

Sauberste Lösung: lagere den Teil in einen eigenen Thread aus! :mahn:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jojojoxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 386



BeitragVerfasst: Mi 22.08.07 17:32 
Hi!

Also, ich habe mich jetzt ein wenig mit Threads beschäftigt und habe meine gesamte Prozedur genommen und in eine andere Unit in einen Thread ausgelagert. Innerhalb dieser Prozedur wird auf ca. 20 versch. visuelle Komponenten zugegriffen und soweit ich das richtig verstanden habe geht das (bzw. sollte man das nur) mit synchronize. Allerdings kann ich nicht für jeden Zugriff eine eigene Prozedur machen, die ich dann mit synchronize aufrufen kann, dann hätt ich ja über 20 neue Prozeduren...
Und meine gesamte Prozedur einfach per synchronize geht auch nicht (Fehler: Es gibt keine überladene Version...)
Wo liegt mein Denkfehler?
mfg

Jojo
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mi 22.08.07 22:22 
Moin!

user profile iconJojojoxx hat folgendes geschrieben:
Wo liegt mein Denkfehler?

Im Designkonzept der Anwendung? :nixweiss: Mir scheint, du trennst nicht vernünftig zwischen Funktion und Darstellung, dann kommt es zu solchen "Effekten"... :?

Ansonsten: die per Synchronize aufgerufene Methode darf durchaus auch aus der Thread-Klasse sein und deren Variablen verwenden :arrow: du kannst also mit einer Zustandsvariablen steuern, was da aktualisiet werden soll (z.B. eine VCL-Kompo). :idea: Dafür muss man nicht verschiedene Methoden anlegen... ;)

cu
Narses

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