Solved

in a very difficult situation now..

Posted on 1998-02-17
7
155 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

943 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now