Thema: Delphi EStackOverflow

Einzelnen Beitrag anzeigen

Benutzerbild von mirage228
mirage228

Registriert seit: 23. Mär 2003
Ort: Münster
3.750 Beiträge
 
Delphi 2010 Professional
 
#2

Re: EStackOverflow

  Alt 13. Mai 2004, 18:19
Hi,

Ich nehme an du hast den Code im OnChange von "useactlinecolor".

Wenn du dort "Checked" setzt dann wird sofort wieder "OnChange" aufgerufen und du landest in einer Endlosschleife bis es zum Stacküberlauf kommt!

Lösung:

Globale Variable (im private Abschnitt des Forms): FUpdating: Boolean;

Der Code sieht dann so aus:
Delphi-Quellcode:
if not FUpdating then
begin
  FUpdating := True;
  try
    // EDIT: So gehts besser:
    UseActLineColor.Checked := not UseActLineColor.Checked;
    ColorBox.Enalbed := UseActLineColor.Checked;
  finally
    FUpdating := False;
  end;
end;
Der Clou: Während FUpdating = True ist, wird dieser Block nicht ausgeführt und somit kommt es zu keiner Endlosschleife.


Ich hoffe, ich habe deine Problem richtig erkannt und gelöst. ^^

mfG
mirage228
David F.

May the source be with you, stranger.
PHP Inspection Unit (Delphi-Unit zum Analysieren von PHP Code)
  Mit Zitat antworten Zitat