Autor Beitrag
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 23.06.05 15:14 
Ich habe in einem MDI-Formular eigene Buttons erstellt, und will jetzt, dass die deaktiviert werden, wenn kein MDI-Child exisitiert. Aktivieren schaffe ich ja, wenn man das MDI-Child errzeugt, aber deaktivieren ???

Bitte helft mir!!!
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 23.06.05 15:17 
beim onClose der MDI-Childs abfragen, wie groß MDIChildCount vom MDIForm ist...

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
jakobwenzel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 23.06.05 15:24 
Funktioniert irgenwie nicht...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  if MainForm.MDIChildCount=0 then
    MainForm.ToolButton4.Enabled:=false;
  Action := caFree;
end;
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Do 23.06.05 15:27 
probiers mal mit 1... das MDICHild dürfte in onClose noch "da sein"

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Pr0g
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 220


D7 Pers
BeitragVerfasst: Do 23.06.05 15:27 
Im OnClose ist das Childfenster ja noch aktiv. Es wird erst nach dem Ausführen des OnClose Codes geschlossen. Daher müsstest du prüfen, ob ein Child vorhanden ist (denn nach dem Schließen sind es ja null):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TMDIChild.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  MainForm.ToolButton4.Enabled := (MainForm.MDIChildCount > 1);
  Action := caFree;
end;


MfG Pr0g
jakobwenzel Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Do 23.06.05 15:29 
Danke, funktioniert!! :lol: