Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi Problem mit Application.ProcessMessages (https://www.delphipraxis.net/137345-problem-mit-application-processmessages.html)

youuu 19. Jul 2009 00:04


Problem mit Application.ProcessMessages
 
Hi,

ich habe ine Problem mit Application.ProcessMessages, bei diesem Code funktioniert alles einwandfrei.

Delphi-Quellcode:
while Node <> nil do
  begin
    .
    .
    .


      Try
        .
        .
        if result then
        Begin
          Customer.status:= 'aktive';
          FormMain.VstCustomer.RepaintNode(Node);
        End
        else
        Begin
          Customer.status:= 'inaktive';
          FormMain.VstCustomer.RepaintNode(Node);
        End;
      Finally
        FormMain.QueryUpdate.Close;
      End;
    Node:= FormMain.VstCustomer.GetNext(Node);  

    FormSplash.LabelStatus.Caption.Text:= 'Kunden werden aktualisiert ... ['+IntToSTr(Count)+' / '+IntToSTr(FormMain.VstCustomer.RootNodeCount)+']'; // Hier wird dem Kunden der Fortschritt angezeigt deswegen Application.ProcessMessages;
    inc(Count);
    Application.ProcessMessages;
  end;

Wenn ich nun allerdings im VstGetText Event noch diese Zeilen hnzufüge

Delphi-Quellcode:
  If Customer.status = 'aktive' Then
    Sender.Font.Color:= ClGreen
  Else
    Sender.Font.Color:= ClRed;
Doch dan bleibt das Programm direkt nach dem 1. Datensatz hängen.


Weiss jemand wieso?

Uwe Raabe 19. Jul 2009 10:04

Re: Problem mit Application.ProcessMessages
 
Um dem Kunden die Änderung des Labels mitzuteilen, reicht auch ein "FormSplash.LabelStatus.Refresh".

Was dein eigentliches Problem betrifft, halte ich es für keine gute Idee im GetText-Event den Font zu ändern, da dies zu einem Neuzeichnen aller Einträge führt, die wiederum ihr eigenes GetText aufrufen. Nach ausreichend langem Warten sollte sich also auch ein Stack-Überlauf einstellen.

Bernhard Geyer 19. Jul 2009 21:10

Re: Problem mit Application.ProcessMessages
 
Problem wurde in neuen Thread gelöst.


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:27 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz