Solved

in a very difficult situation now..

Posted on 1998-02-17
7
154 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

21 Experts available now in Live!

Get 1:1 Help Now