Autor Beitrag
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Sa 04.03.06 15:18 
Hallo,
habe mal für das Thema von MAC (Gleichung mit 3 Unbekannten) unter Verwendung von Delphifan's Vorschlag ein kleines Demoprogrämmchen gebastelt. Läuft auch prima - aber dabei habe ich o.g. Problem entdeckt, das mich an galoppierendes Alzheimer denken läßt.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm1.Button1Click(Sender: TObject);
var
I,E,S,N: Integer;
begin
  I :=0;
  Panel2.Caption :='wait';  //<<<<<<<< das wird NICHT ausgeführt
  Button1.Cursor := crHourGlass;  // (<--funktioniert )
  for E := 1 to Res do
   for S := 1 to Res do
    for N := 1 to Res do
     if (E+S+S+E+N=Res) and (E<>S) and (S<>N) and (E<>N) then
     begin
      inc(I);
      Memo1.Lines.Add(format('I=%d: E=%d; S=%d; N=%d',[I,E,S,N]));
     end;
  Panel2.Caption :=IntToStr(I);  //<<<<<<< das hier wird ausgeführt
  Button1.Cursor :=crDefault;    // dito
end;

procedure TForm1.Edit1Exit(Sender: TObject);
begin
  Res :=StrToInt(Edit1.Text);
  Memo1.Lines.Clear;
  Panel2.Caption :='';   //<<<<<< das wird ausgeführt
end;


Wieso wird am Anfang der ButtonClick-Routine die Zuweisung an Panel2 grundsätzlich nicht ausgeführt??
Fiel mir auf, als ich den Button anklickte, ohne etwas im Editfeld geändert zu haben.
Was habe ich übersehen? Macht mich ganz irre :autsch:
Gruß, Horst
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.03.06 16:15 
Schon Application.ProcessMessages; probiert?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
aim65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Sa 04.03.06 16:47 
Vielen Dank, hab's ausprobiert - das geht.
Aber ich begreife immer noch nicht, warum die zweite Zuweisung (Ergebniszahl der Loop) an Panel2 auch ohne "Application.PMsg" funktioniert; die Cursor-Änderung auch. Habe nichts darüber in meinen schlauen Büchern gefunden (oder übersehen...). :gruebel:
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 04.03.06 16:49 
Liegt vielleicht an der Priorität.

Cursor > Funktion > Panel.Caption

> = wichtiger als

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
aim65 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Sa 04.03.06 17:05 
Die Cursor-Funktionen haben keinen Einfluß auf die Sache (nach Auskommentierung ändert sich nichts).
Wäre schon komisch, wenn zur Ansteuerung eines Panels via ButtonClick eine Prozedur/Funktion notwendig sein sollte. Werde das mal ausprobieren. Vielleicht gibt's ja irgendwo eine Erklärung dafür.

Noch mal vielen Dank für die Hilfe