Solved

is there a onfocus procedure for forms?

Posted on 1998-02-17
10
404 Views
Last Modified: 2010-04-04
i want my main form to receive the focus after closing
all my MDI Child forms in it..so i can disabled the
buttons on my toolbar when there are no mdi child forms...
can anyone pls guide me....? thanx
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
  • 6
  • 3
10 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1359409
When all of MDI childs closed does not Form got the focus? If it does use OnEnter event of form (called onFocussed in TPW days).

Igor
0
 

Expert Comment

by:dr_gonzo
ID: 1359410
It has an onActivate. Beacuse forms don't get focused they get activated.

MTFBWU,
Dr. Gonzo
0
 

Author Comment

by:cooldude77
ID: 1359411
i need to get my main form focus..but it always never worked..
for my procedure..i tried activate oledi..but also never
work..
i need to disable the buttons on my toolbar when my master MDI Form
gets the focus..can anyone help?
0
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!

 
LVL 5

Expert Comment

by:inter
ID: 1359412
I have already answered your question

look at

- 'in a very difficult situation now..'

Igor
0
 

Author Comment

by:cooldude77
ID: 1359413
i tried yr method b4 i asked the question..wondering if there is any other way..
0
 
LVL 5

Accepted Solution

by:
inter earned 10 total points
ID: 1359414
Try this,

In MDIChilds OnClose Event do this:

procedure TMDIChild.FormClose(...);
begin
  if TMdiMaster(Parent).MDIChildCount = 1 then
     TMdiMaster(Parent).UpdateToolbarAndMenu(Self);
  CanClose := true;
end;
0
 

Author Comment

by:cooldude77
ID: 1359415
procedure TEditForm1.Close1Click(Sender: TObject);
begin
Close;

end;

procedure TEditForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 Action := caFree;

end;
there is no CanClose here...i cannot use yr code..

0
 
LVL 5

Expert Comment

by:inter
ID: 1359416
No problem just remove the CanClose! and test it.

Important thing is that you should get the idea. The idea is upon closing each MDICHILD check parent of it and call the UpdateToolAnd.. methods or done any special processing. By this way when the LAST one is closed everything expected to go OK.

Got it? (Not very clever but since you require ANOTHER way)
Igor
0
 
LVL 5

Expert Comment

by:inter
ID: 1359417
No problem just remove the CanClose! and test it.

Important thing is that you should get the idea. The idea is upon closing each MDICHILD check parent of it and call the UpdateToolAnd.. methods or done any special processing. By this way when the LAST one is closed everything expected to go OK.

Got it? (Not very clever but since you require ANOTHER way)
Igor
0
 
LVL 5

Expert Comment

by:inter
ID: 1359418
No problem just remove the CanClose! and test it.

Important thing is that you should get the idea. The idea is upon closing each MDICHILD check parent of it and call the UpdateToolAnd.. methods or done any special processing. By this way when the LAST one is closed everything expected to go OK.

Got it? (Not very clever but since you require ANOTHER way)
Igor
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 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