Autor Beitrag
g1o2k4
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 493



BeitragVerfasst: Fr 16.11.07 15:59 
hi


ich habe mehrere threads die parallel laufen. jeder thread soll in der mainform ne fortschrittsleiste ändern....für jeden threads gibt es eine fortschrittsleiste !

grob siehts so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
im thread
begin
  TForm1.GaugeX.Progress := TForm1.GaugeX.Progress + 1;
end;


ich brauche jetzt für GaugeX (Fortschrittsleiste) nen platzhalter. mit nem string in dem die nummer der leiste steht klappt es nicht....
also
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
X: String;
X := Gauge1;

X wird an den thread übergeben...

thread
begin
  TForm1.X.Progress := TForm1.GaugeX.Progress + 1;
end;


wie sorge ich dafür, dass verschiedene leisten von ein und dem selben thread gerüst angesprochen werden ?
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 16.11.07 16:08 
Das muss man generell andersrum machen ;-).

Der Thread muss der Form sagen, welche Gauge sie neu zeichnen soll. Der Thread selbst darf auf der Form nicht rummalen, das gibt nur Probleme. Stichwort ist Synchronize.

D.h. du gibst dem Thread eine Nummer mit, und der Thread gibt diese Nummer wieder zurück an die Form und lässt die Anzeige neu zeichnen. Im Übrigen suchst du wahscheinlich FindComponent.

_________________
We are, we were and will not be.
g1o2k4 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 493



BeitragVerfasst: Fr 16.11.07 16:15 
ich brauch halt nur

einen platzhalter
für Gauge1-GaugeX

so dass es den dann statt Gauge in den befehl schreiben kann
TForm1.Platzhalter.Progress := TForm1.Platzhalter.Progress + 1;
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 16.11.07 16:18 
Du brauchst nicht nur einen Platzhalter, du musst dein System überdenken. Ein anderer Thread darf nicht auf VCL-Komponenten zugreifen.

Ansonsten: Meine Antwort von oben lesen, und unbekanntes Delphi-Gedöns in der Hilfe nachgucken, oder im Forum suchen ;-).

_________________
We are, we were and will not be.
g1o2k4 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 493



BeitragVerfasst: Fr 16.11.07 16:33 
ich weiß dass man das nicht darf, aber ich will das programm auch an niemanden verkaufen !
ich bin ja selbst schuld wenn ich falsche werte bekomme.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8548
Erhaltene Danke: 477

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 16.11.07 18:09 
Nein, du bist selbst schuld, wenn das Programm zwischendurch einfach so abstürzt. Ich will mein Auto auch nicht verkaufen, trotzdem wechsel ich nicht bei Tempo 100 die Reifen...

_________________
We are, we were and will not be.
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Fr 16.11.07 19:40 
Kommunikation via PostMessage. Blockiert nicht und ist einfach in der Anwendung.