Autor Beitrag
Dhakiyah
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 327
Erhaltene Danke: 5

Windows 7
Delphi XE2
BeitragVerfasst: Fr 29.01.10 14:08 
Hallo!
Ich bräuchte ein Infofenster, so wie die Messagebox, nur OHNE Button mit einem reinen Infotext, der sich nach 5sec schließt...
Gibt es in Delphi sowas?

Gruß Jasmin

_________________
Es ist soooo flauschig !!!
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Fr 29.01.10 14:11 
Für soetwas würde ich eine eigene kleine Form nehmen, bei der im OnShow ein Timer gestartet wird, in dessen OnTimer-Event der Timer wieder deaktiviert und die Form geschlossen wird.

Ein vorkonfiguriertes Message-Fenster mit diesem Verhalten ist mir nicht bekannt.

_________________
We are, we were and will not be.
ardani
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 36

Win XP
Delphi 6, C++ (VS Express)
BeitragVerfasst: Fr 29.01.10 14:13 
Du könntest dir nen zweites Formular nehmen, da nen Timer draufsetzen und dann halt als timer ereignis nen

ausblenden Delphi-Quelltext
1:
Form2.hide;					


setzen.
Und zur Übergabe kann man ja ne Globale variable benutzen.

Ich hoffe ich konnte ein wenig weiterhelfen. Was anderes wäre mir jetzt nicht bekannt

mfg

ardani


//edit: ok, Gausi war schneller^^
Fussel9
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 23

Win 7
Delphi
BeitragVerfasst: Fr 29.01.10 17:44 
sinn voll wäre wahrscheinlich auch für die Form2.Show
[Delphi/]Form2.ShowModal;[/Delphi]
zu verwenden...
Dann kann man solange nichts anderes machen bis dein Timer Form2.hide ausführt.
auch alle befehle die du hinter ShowModal verwendest werden erst verarbeitet wenn die form geschlossen ist.

BSP:
proz...
var...
begin
ShowMessage('Gleich gehts los');
Form2.ShowModal;
ShowMessage('Das wars!');

//Hier wird dir die Message ''Das wars!'' erst angezeit wenn Form2 wieder geschlossen ist.
Reinhard Kern
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 591
Erhaltene Danke: 14



BeitragVerfasst: Fr 29.01.10 18:56 
user profile iconDhakiyah hat folgendes geschrieben Zum zitierten Posting springen:
Hallo!
Ich bräuchte ein Infofenster, so wie die Messagebox, nur OHNE Button mit einem reinen Infotext, der sich nach 5sec schließt...
Gibt es in Delphi sowas?

Gruß Jasmin


Hallo,

ich leite mir dazu eine Form von der folgenden ab (die kann man mit ok schliessen, sonst Timeout):

ausblenden volle Höhe 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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
const BPLMsgMaxTime = 20;

type
  TFrm_BPLMsg = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Bt_MsgOk: TButton;
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Bt_MsgOkClick(Sender: TObject);
  private
    { Private-Deklarationen }
    TO_Timer : TTimer;
    TO_Count : integer;
  public
    { Public-Deklarationen }
    StartX,StartY : integer;
    procedure TimeOut (Sender: TObject);
    procedure SetMsgText (ix : integer; Txt : ShortString);
    procedure SetPosition (X,Y : integer);
    procedure ShowIt;
  end;

var
  Frm_BPLMsg: TFrm_BPLMsg;

implementation

uses BLMain;
{$R *.dfm}

procedure TFrm_BPLMsg.FormShow(Sender: TObject);
begin
if (StartX > 0) and (StartY > 0) then
  begin
  Left := StartX;
  Top := StartY;
  end;
TO_Count := BPLMsgMaxTime;
if not Assigned (TO_Timer) then
  TO_Timer := TTimer.Create (nil);
TO_Timer.OnTimer := self.TimeOut;
TO_Timer.Interval := 1000;
TO_Timer.Enabled := true;
end;

procedure TFrm_BPLMsg.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
if Assigned (TO_Timer) then
  begin
  TO_Timer.Enabled := false;
  TO_Timer.Destroy;
  TO_Timer := nil;
  end;
end;

procedure TFrm_BPLMsg.TimeOut (Sender: TObject);
begin
if TO_Count > 0 then
  begin
  TO_Count := TO_Count - 1;
  if TO_Count = 0 then Bt_MsgOkClick(Sender);
  end;
end;

procedure TFrm_BPLMsg.Bt_MsgOkClick(Sender: TObject);
begin
Close;
end;

procedure TFrm_BPLMsg.SetMsgText (ix : integer; Txt : ShortString);
begin
case ix of
  0 : Caption := Txt;
  1 : Label1.Caption := Txt;
  2 : Label2.Caption := Txt;
  else;
  end;
end;

procedure TFrm_BPLMsg.SetPosition (X,Y : integer);
begin
StartX := X;
StartY := Y;
end;

procedure TFrm_BPLMsg.ShowIt;
begin
if not Visible then Show;
end;

irgenwo gehen die Leerzeilen verloren - na what shells.

Gruss Reinhard

PS meistens verwende ich die Form direkt, ohne Ableitung.