Solved

is there a onfocus procedure for forms?

Posted on 1998-02-17
10
403 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
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!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…

730 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