Autor Beitrag
winx
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Do 18.08.05 09:30 
Hi,

ich möchte folgendes:

Ich habe eine Unit, in der per WebService Daten geholt werden. Während nun diese Daten geholt werden, soll ein Formular (oder irgendwas anderes, auf das man schreiben kann) aufpoppen und den aktuellen status anzeigen.

das form poppt auf, jedoch ist es LEER. Obwohl ich auf ein Panel das darauf plaziert ist, Texte schreibe.

Woran kann das liegen??? Wie kann ich Abhilfe schaffen?

Der Code sieht so aus:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
 infoForm := TFormInformation.Create(TController.getInstance.MainForm);
 infoForm.setInfoText('Getting Data...');
 infoForm.Show;
 // DER WEBSERVICE AUFRUF
 infoForm.setInfoText('Parsing Data');
 // DATEN WERDEN GEPARST
 infoForm.setInfoText('Ready');
 sleep(1000);
 infoForm.Close;
 infoForm.Free;


Danke,
winx

Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
killavirus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 49

Win 2000
D5 Prof, D7 Prof
BeitragVerfasst: Do 18.08.05 09:42 
Hallo,

du kannst es mal mit einem
ausblenden Delphi-Quelltext
1:
Application.ProcessMessages;					

nach deinem Funktionsaufruf setInfoText probieren.

_________________
I need a girl whose name doesn't end in .JPG
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Do 18.08.05 09:48 
bringt leider nichts :(
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 18.08.05 09:53 
hi,

probier es mal mit einem infoform.update; und ggf anschließend mit application.processmessages;

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Do 18.08.05 10:01 
bringt auch nix.

hab jetzt auch mal veruscht einen "Standardtext" im Objektinspektor bei Caption anzugeben, aber ich sehe nicht mal diesen...
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 18.08.05 12:09 
wo schreibst du den text denn rein? Panel, label?

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Do 18.08.05 14:04 
In ein Panel, wieso?
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Do 18.08.05 14:27 
Hi,

zeig mal den code, wie er mit den änderungen aussieht.

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Fr 19.08.05 07:08 
also jetzt hab ichs soweit, dass der Anfangstext angezeigt wird, jedoch werden Änderungen während des Ws Aufrufes nicht sichtbar. Hab nen Timer eingebaut der den Text ändern soll...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
  infoForm := TFormInformation.Create(nil);
  infoform.setInfoText('Receiving Data...');
  infoForm.Show;
  infoForm.Update;
  Application.ProcessMessages;

  //WebServiceAufruf, hier soll ein Timer auf dem infoform den Text des forms ändern, da der aufruf so 1 minute dauert
  
  infoForm.Close;
  infoForm.Free;


Moderiert von user profile iconAXMD: Code- durch Delphi-Tags ersetzt.
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Fr 19.08.05 09:41 
hi,

und wie sieht der code im ontimer event aus?

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
winx Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 249



BeitragVerfasst: Fr 19.08.05 10:11 
ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
unit InformationForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TFormInformation = class(TForm)
    PanelInformation: TPanel;
    Timer1: TTimer;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormShow(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    procedure setInfoText(text:string);
  end;

implementation

{$R *.dfm}

{ TFormInformation }

procedure TFormInformation.setInfoText(text: string);
begin
  PanelInformation.Caption := text;
  self.Update;
  Application.ProcessMessages;
end;

procedure TFormInformation.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Timer1.Enabled := false;
end;

procedure TFormInformation.FormShow(Sender: TObject);
begin
  Timer1.Enabled := true;
end;

procedure TFormInformation.Timer1Timer(Sender: TObject);
begin
  setInfoText(PanelInformation.Caption +'.');
end;

end.
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Fr 19.08.05 11:36 
ok,

das kann nicht wirklich gehen. Das problem ist nämlich, daß der Hauptthread deiner Anwendung auf das Ergebnis der Anfrage warten muss, dementsprechend wird auch der OnTimer-Code nicht ausgeführt, weil das event im hauptthread verarbeitet wird - der wartet aber. Am einfachsten wäre es wohl, wenn du die Anfrage in einen Thread auslagerst.

Hier im Forum findest du genug zu thread-programmierung.

Gruß
Ken

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.