Solved

in a very difficult situation now..

Posted on 1998-02-17
7
158 Views
Last Modified: 2010-05-19
i have to keep track of the number MDI child forms
in my MDI master forms..i tried using MDIChildCount
but it does not work correctly..
my toolbar buttons are not disable propertly..when
the num of MDI child forms are decreased...
the logic: if no MDI child forms..disable save, print buttons..
if have mdi child forms..enable save, print, buttons...
can someone pls give me some sample code to how this is done? thanx a lot..
0
Comment
Question by:cooldude77
  • 4
  • 3
7 Comments
 
LVL 5

Accepted Solution

by:
inter earned 60 total points
ID: 1359447
Do depend on MDI child count:

In Mainform create

...
  Screen.OnActiveFormChange := UpdateToolbarAndMenu;
...

add this to mainform

procedure TMainForm.UpdateToolbarAndMenu(Sender: TObject);
begin
  FileCloseBtn.Enabled := MDIChildCount > 0;
  FileSaveBtn.Enabled := MDIChildCount > 0;
  ... etc
end;


GOT IT
Bye
Igor
0
 

Author Comment

by:cooldude77
ID: 1359448
Screen.OnActiveFormChange := UpdateToolbarAndMenu;
where do i put this? under mainform.create or mainform.new1click?
new1click is creating a new file..
i tried yr method oledi..
still has  a bug disenabling the buttons after no
MDI child forms exist...
if i create a counter i don't use MDIChildCount..how do i do it then?
0
 
LVL 5

Expert Comment

by:inter
ID: 1359449
You should place is in MDI master FormCreate method.

By the way what version of Delphi are you using?

Igor
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:cooldude77
ID: 1359450
i put it under formcreate and it works sometimes..and somes it does not work..
i am using delphi 3 pro
0
 

Author Comment

by:cooldude77
ID: 1359451
if i use a var to count the mdi child forms created and destroy..
will it work?
 my problem lies in having
SpbtnSave.Enabled := MDIChildCount > 0,
 when closing all forms -that is no child forms exists in
the MDI master form,
my MDIChildCount is still "1" so the buttons get enabled..
is there a way to correctly detect MDIchildCout?
0
 
LVL 5

Expert Comment

by:inter
ID: 1359452
If the project does not contain a KNOWHOW please zip it and send it to me. Or delete some parts and send! (for you privacy)

Then list the modifications you want I DO THEM FOR YOU! Offer a points for this and DO THIS friend. This may be better for both you and me. List all the things and combine all your other questions. I analyze the program and detect how MDIChildCOunt be 1 even if there is no child! (Actually you can, just check MDIChilds[0].Name if it is not empty you have an MDIChild still hiding somewhere...etc..

THERE IS ALWAYS A WAY -WEIRD, DIRTY OR CLEAN- DONT WORRY
Igor
0
 
LVL 5

Expert Comment

by:inter
ID: 1359453
BTW

please if you can delete your toolbar buttons etc. I dont mean to steal them but be comfortable.

Igor
inter@kosgeb.tekmer.gov.tr
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 304
delphi exception 7 64
how to center only a line in richedit? 4 58
Run video youtube webbrowse 10 62
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question