Solved

in a very difficult situation now..

Posted on 1998-02-17
7
160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Reconfigure Delphi Install? 2 77
How to Get Images From Server using App Tethering 11 52
DBCtrlGrid, Delphi, Scroll 7 35
QuickReport, Delphi, Shape 12 47
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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