Autor Beitrag
motion
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Di 08.05.07 16:55 
Welches Event im Leben eines Formulars feuert nach Formshow?
Ich muß eine Aktion starten (Abfrage eines Wertes per Modalem Eingabedialog), sobald das Fenster sichtbar ist.
Mache ich den Aufruf im FormShow Eventhandler, ist leider das eigentliche unter dem Eingabedialog liegende Fenster noch nicht zu sehen.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Di 08.05.07 16:56 
Kannst du nicht beim aufrufen zuerst das alte Formular verstecken und dann das neue Zeigen?

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
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 08.05.07 17:03 
Du kannst das ganze mit OnActivate des Formulars machen, musst dann aber als erstes in der Behandlung den Event-Handler für OnActivate auf Nil setzen, bevor Du die eigentliche Aufgabe ausführst.

_________________
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.
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 08.05.07 19:03 
Hallo,

oder mit PostMessage und WM_AFTER_SHOW , poste mal eine komplette Beispiel-Unit, ist ja nicht viel:
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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
const
  WM_AFTER_SHOW = WM_USER + 300// custom message
type
  TForm1 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    procedure WmAfterShow(var Msg: TMessage); message WM_AFTER_SHOW;
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.WmAfterShow(var Msg: TMessage);
begin
  ShowMessage('Hallo');
end;

procedure TForm1.FormShow(Sender: TObject);
begin
  PostMessage(Self.Handle, WM_AFTER_SHOW, 00);
end;

end.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
motion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Di 08.05.07 19:13 
@jakobwenzel:
Nein, weil das aufrufende Fenster unabhängig im Hintergrund bleibt. Also
Form_Lagerverwaltung -> Form_"schnell-Inventur" -> EingabeDialog Buchungstext (modal)

Form_schnell-Inventur wird per SHOW, nicht showmodal, aufgerufen, so das die Lagerverwaltung parallel weiter genutzt werden kann. Die Schnell-inventur soll also sichtbar werden und dann als erstes gleich der Modale Eingabedialog erscheinen. Der Aufruf des Eingabe-Dialogs ist hier die Frage.

@BenBE: ich hab's mal versucht:
ErsterAufruf:Boolean

im Formcreate: ErsterAufruf:=True;

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
procedure TForm_Assi_Inventur.FormActivate(Sender: TObject);
begin
  inherited;
  If ErsterAufruf then
    Begin
      ErsterAufruf:=False;
      AbfrageString(Titel,'Bitte geben Sie den Buchungstext ein, der in der'+CRLF+'Artikelhistorie erscheinen soll','Buchungstext',self,Buchungstext,TBvO_edit,False);
      AnzeigeBuchungstext.Caption:=Buchungstext;
    End;
end;


Funktioniert leider nicht. Der Eingabedialog wird angezeigt, aber das aufrufende Form ist noch nicht zu sehen.
Habe ich da noch was übersehen?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 10.05.07 11:22 
Hallo,

user profile iconmotion hat folgendes geschrieben:
...
Habe ich da noch was übersehen?

eventuell meinen Beitrag :wink:

hab entsprechend Deiner Vorgabe das nochmal getestet:

-> Form_Lagerverwaltung
-> Form_schnell-Inventur.Show <--- in der Unit mein Code-Vorschlag
-> EingabeDialog.ShowModal

Es funktioniert, der EingabeDialog wird zusammen mit Form_schnell-Inventur angezeigt.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
motion Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 295

XP, Linux
D7 Prof
BeitragVerfasst: Do 10.05.07 11:38 
@Lannes:
In der Tat, Deinen Beitrag (10 Min. vor meiner Antwort) habe ich nicht gesehen.
Hatte wohl eine Antwort begonnen, BEVOR Du geantwortest hast und dann NACH Deiner gepostet.
Wie dem auch sei:
Sehr gute und elegante Lösung!
Das ich mit Form-Vererbung arbeite, nehme ich diese Erweiterung in meinem Basis-Form vor und kann es dann in allen abgeleiteten Fenstern verwenden.

Vielen Dank