Autor Beitrag
ts-d
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 26.05.09 06:19 
Hauptprogramm öffnet Formular mit Progressbar, die anzeigt, wie lange die Datenübernahme noch braucht.
Am Ende versuche ich mit close das Formular mit der Progressbar zu schließen - geht nicht.
Auch ein Klick ins rechte obere Systemfeld schließt das Formular nicht.

Weiß jemand, warum?
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Di 26.05.09 08:43 
Na, da wäre ja erstmal die Frage, ob Du das nicht nur immer wieder per Timer neu aufrufst...
Dann würde ich das ja so schreiben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
FormProgressBar.OnClose(ParameterWeißIchJetztNichtAusWendig);
begin
TimerFortschrittsHinweis.Enabled:=False;
end;

Ich hoffe, dass ich Dich damit nicht total verkehrt verstanden habe.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 26.05.09 10:04 
Könntest Du bitte etwas Source zeigen, wie du mit deinem Progress-Form arbeitest?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
ts-d Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 26.05.09 10:30 
Ich verstehe deine Antwort nicht ganz: Mein Problem ist, dass das Formular sich am Ende nicht schließen lässt,
weder codegesteuert noch manuell durch Benutzerklick auf die Schliessen-Schaltfläche.

Der Timer hilft da wohl nicht weiter oder?
ts-d Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 26.05.09 10:43 
o.k. etwas Code:

Im Hauptformular läuft eine Importroutine - ein paar Zeilen sehen so aus:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
        ....
          SQL.Clear;
          SQLText := 'UPDATE Auftragkopf SET STANDAUFTR8=''0''  WHERE STANDAUFTR8 IS NULL';
          SQL.Add(SQLText);
          ExecSQL;
          ProgressBarAktualisieren;
          ....


In der Routine ProgressBarAktualisieruen steht folgendes:

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:
  

procedure TMainForm.ProgressBarAktualisieren;
var
  ProgressBarWert: Integer;
  //ImportSekunden, ImportSekunden_X: Extended;
  ZeitDatenimport_X: TDateTime;
  //StundenDatenimport, MinutenDatenimport, SekundenDatenimport, MilliSekundenDatenimport: Word;
begin

  //Die Variable ImportZeit wurde aus der Registry eingelesen - ist einfach die Dauer vom letzten Datenimport

  ZeitDatenimport_X := Now - ZeitDatenimport;    //Seit ZeitDatenimport vergangene Zeit ...
    ProgressBarWert := trunc(ZeitDatenimport_X / StrToDateTime('00:' + ImportZeit) * 100);
  if ProgressBarWert > 0 then
    Dialog_StatusInformation.ProgressBar.Position := ProgressBarWert
  else if ProgressBarWert >= 100 then begin
    Dialog_StatusInformation.ProgressBar.Position := 100;
  end;

  Dialog_StatusInformation.ProgressBar.Refresh;

end;


Nachdem der Import abgeschlossen ist, wird im Hauptformular die Zeile ausgeführt:

ausblenden Delphi-Quelltext
1:
  Dialog_StatusInformation.Close;					
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 26.05.09 10:44 
Danke für das Effiziente Auslssen genau der wichtigen Zeilen:

Erzeugen des Progress-Forms, Anzeigen, Aktualisieren und Schließen ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
ts-d Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 25



BeitragVerfasst: Di 26.05.09 10:52 
Erzeugen des Progress-Formulars:

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:
26:
27:
unit StatusInformation;

interface

uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
  Buttons, ExtCtrls, ComCtrls, jpeg, Dialogs;

type
  TDialog_StatusInformation = class(TForm)
    Image1: TImage;
    ProgressBar: TProgressBar;
    Label_Information: TLabel;

  private
    { Private declarations }
  public
    { Public declarations }
    t: Integer;
  end;

var
  Dialog_StatusInformation: TDialog_StatusInformation;

implementation

{$R *.DFM}
end.



Anzeigen des Progress-Formulars:

ausblenden Delphi-Quelltext
1:
Dialog_StatusInformation.Show;					



Das Schließen des Formulars hast du schon - das hast du vielleicht übersehen ... :wink:
MDX
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 595
Erhaltene Danke: 4

Windows 8.1, Linux Debian 8, Android Lollipop
Delphi, PHP, Java (Android)
BeitragVerfasst: Di 26.05.09 12:45 
Er meinte glaub ich eher die komplette Procedure oder Function die das Öffnet und Schließt, den wie man ein Formulaer öffnet ist im sicherlich bekannt und ist auch mit Show/Showmodal und Close die leichteste (und vielleicht einzigste?) Möglichkiet.
Also schreib deine Procedure oder Funktion in der das Formular geöffnet wird, sonst kann dir niemand richtig helfen. (Denke ich?)