Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

is there a onfocus procedure for forms?

Posted on 1998-02-17
10
Medium Priority
?
407 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 20 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

Technology Partners: 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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

916 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