Autor Beitrag
Morpheus1572
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Fr 18.04.08 06:21 
Moin Leutz,

Habe ein hauptform (Parent) in dem ein Statusfenster (Child) aufgeht. während das zu sehen ist möchte ich verhindern, dass irgendetwas vom Hauptform ausgeführt werden kann. ich will es also quasi sperren. Wie mache ich das?

Gruß Morph.

p.s: habe nichts gefunden, weil ich nicht weiß wo nach ich suchen soll. sorry, wenn die frage schon 1.000 mal gestellt wurde.


Moderiert von user profile iconNarses: Topic aus Windows API verschoben am Fr 18.04.2008 um 10:05
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Fr 18.04.08 09:06 
Moin!

user profile iconMorpheus1572 hat folgendes geschrieben:
Habe ein hauptform (Parent) in dem ein Statusfenster (Child) aufgeht. während das zu sehen ist möchte ich verhindern, dass irgendetwas vom Hauptform ausgeführt werden kann. ich will es also quasi sperren. Wie mache ich das?
Öffne das 2. Form mit ShowModal, statt mit Show. :idea:

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 18.04.08 09:11 
ShowModal.
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Sa 19.04.08 06:26 
Moin,

also das mit ShowModal funzt nicht. Ich gebe vielleicht noch mal genauer an was passiert und was ich mache:

1. Das Haupformular geht auf (unter Projekte - Optionen - Formulare liegt das Form4 (mein kontrollform) unter 'verfügbare Formulare'
2. da es sich um ein Childfenster handelt und es wie unter 1 beschrieben noch nicht existiert muss ich es ja mit 'Form4.Create(Self);' aufrufen. Form4.ShowModal funzt hier nicht.

Wo ist mein Denkfehler?

Gruß Morph.
Bernhard Geyer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 721
Erhaltene Danke: 3



BeitragVerfasst: Sa 19.04.08 07:43 
user profile iconMorpheus1572 hat folgendes geschrieben:
2. da es sich um ein Childfenster handelt und es wie unter 1 beschrieben noch nicht existiert muss ich es ja mit 'Form4.Create(Self);' aufrufen. Form4.ShowModal funzt hier nicht.

Wo ist mein Denkfehler?

In fehlendem Grundlagenwissen von Objekt Pascal/Delphi. Die Create-Methode ist eine Klassenmethode (und auch noch der Konstruktor) und wird auf die Klasse angewendet und hat einen Rückgabewert welche das erzeugte Formular beinhaltet.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  dlg: TForm4;
begin
  dlg := TForm4.Create(self);
  try
    dlg.ShowModal;
  finally
    dlg.Free;
  end;
end;
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Sa 19.04.08 14:49 
@Bernhard Geyer: Wohl gesprochen. ich bin noch an den anfängen und ich gebe zu ich tue mir schwer mit dem umgang von klassen und instanzen und wie sie nicht alle heißen. so richtig "klick" hats bei mir noch nicht gemacht.

ich habe das jetzt mal umgesetzt und habe folgende meldung als ergebnis:

Aus einem sichtbaren Fenster kann kein modales gemacht werden.

Also dachte ich mir, ich mach es unsichtbar. visible = false. ABER nichts da. wenn ich das zur entwurfszeit mache bekomme ich ebenfalls einen solchen hinweis...
Morpheus1572 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 157

Win XP
Delphi 7
BeitragVerfasst: Mo 21.04.08 07:03 
Gut Problem gelöst.

Ich hatte schon mal den fall, dass ich nur MDIChilds öffnen konnte und andere Fenster nciht zu gesicht bekam, deswegen habe ich es gar nicht erst versucht das Form4 anders zu deklarieren.

Jetzt habe ich es aber als fsStayOnTop deklariert und es funktioniert. danke an alle.

Gruß Morph.