Autor Beitrag
Blawen
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 08.07.07 00:30 
Hallo Zusammen

Ich habe ein Hauptformular mit einem Menü (JvXPBar) auf der linken Seite (siehe Anhang). Durch anklicken eines Menupunktes wird nun eine Form nach folgender Variante eingeblendet.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TFMainform.JvXPBar1Items3Click(Sender: TObject);
begin
  FMArb_verw.Parent:=Panel1;
  FMArb_verw.Show;
  FMArb_verw.Align := alClient;
  FMArb_verw.BorderStyle:= bsNone;
end;


Nun zu meinem eigentlichen Problem:
Wenn ich einen Menupunkt zum ersten mal aufgerufen habe, wird die neue Form angezeigt und allfällige Ereignisse (OnActivate, OnShow, etc.) werden ausgeführt. Wenn ich nun anschliessend einen anderen Menupunkt aufrufe, bleibt mein Formular jedoch noch immer bestehen. Bei einem erneuten Aufruf des vorherigen Menupunktes kehre ich wieder zu meinem Formular zurück, die Ereignisse OnShow, OnActivate (etc.) werden aber nicht mehr abgearbeitet.

Meine Frage zielt nun darauf ab, wie ich bei einem Menüwechsel mein Formular (automatisch) schliessen (.close) lassen kann. (Ich benötige die Ereignisse OnShow (etc.) zum sicherstellen von definierten Startbedingungen)

Kann mir ev. jemand einen Tipp geben?

Gruss
Blawen
Einloggen, um Attachments anzusehen!
_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: So 08.07.07 00:42 
öhm

einfach im OnClick vom Menü alle anderen Fenster schließen?

Gruß

Aga
Blawen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 08.07.07 01:01 
user profile iconAgawain hat folgendes geschrieben:
öhm

einfach im OnClick vom Menü alle anderen Fenster schließen?

Gruß

Aga

Hallo Aga

Würde aber schätzungsweise bedeuten, dass jede Form einzeln (von Hand) geschlossen werden müsste...
(Da es mehrere JvXPBar-Menüs sind, müsste im Prinzip jede Form in jedem Menu aufgeführt, bzw. eine entsprechende Procedur ausgeführt werden).

Gibt es nicht ev. Probleme, wenn versucht wird ein Formular zu schliessen, welches u.U. gar nicht "angezeigt" wird. (ich stelle momentan kein Problem fest, aber man weiss ja nie)


Ist Dir ev. noch ein anderer Weg bekannt?

Gruss
Blawen

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: So 08.07.07 01:24 
geht auch noch anders, onDeactivate vom Unterformular, dann schließen.
Blawen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 08.07.07 01:43 
user profile iconAgawain hat folgendes geschrieben:
geht auch noch anders, onDeactivate vom Unterformular, dann schließen.

Das Problem ist, dass das Formular dies anscheinend gar nicht mitbekommt und daher gar nicht aufgerufen wird.

Wenn ich im Formular z.B. einen Button einbaue und ein x-beliebiges Formular aufrufe, welches nicht innerhalb des Hauptformulars aufgerufen wird, wird OnDeactivate aufgerufen. Sobald das Fenster aber innerhalb des Hauptformulars eingeblendet wird, wird onDeactivate nicht ausgeführt.

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
Agawain
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 460

win xp
D5, MySQL, devxpress
BeitragVerfasst: So 08.07.07 02:13 
Also handelt es sich offenbar um MDI-Fenster. Sorry das ist nicht meine Baustelle.
Hab da gerade ein bissel mit rumgespielt, mit MDI und festgestellt, wird auch nie meine Baustelle sein, zumindest nicht in D5

hab gerade mal 2 Forms erstellt, das Hauptformular lädt direkt form2, ohne daß ich was mach. Witzigerweise schiebt sich Form2 unter den Button von Form1
Krieg ja Form2 noch nicht mal im OI angezeigt.

Ist kein Umgang für mich :wink:

Müßen Dir andere helfen, oder die Sache mit dem Menu weiterverfolgen

Gruß

Aga
Blawen Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 616
Erhaltene Danke: 33

Win XP, Vista, 7
Delphi 5 Prof., BDS 2006 Prof. RAD Studio XE
BeitragVerfasst: So 08.07.07 03:11 
Danke für Deine nette Hilfe :-)

Kann mir ev. jemand anderes einen Tipp geben?

_________________
Es kompilert, wir können ausliefern.
Und es kompiliert wieder - das Update ist fertig - bitte 100 Euro ;-)
uko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 220
Erhaltene Danke: 1

Win XP, VISTA, WIndows 7
Delphi 2007/2010 Prof
BeitragVerfasst: So 08.07.07 09:35 
Irgenwie dürftest Du ja wissen, ob ein Formular gerade sichtbar ist und was das gerade für ein Formular ist, oder? Dann kannst Du doch bei einer Menüauswahl erst mal schauen, ob eines aktiv ist und wenn ja, dann schließe es. Wenn Du noch keine Referenz auf das gerade aktive Formular hast, dann speicher Dir doch selbige.

Also irgendwas von der Güteklasse:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
...
if FCurrentForm <> nil then
begin  
  FCurrentForm.Close;
  FCurrentForm := nil;
end;

FCurrentForm := TXYZForm.Create(...);
FCurrentForm.Show;


Grüße,
Uli