Solved

is there a onfocus procedure for forms?

Posted on 1998-02-17
10
398 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

18 Experts available now in Live!

Get 1:1 Help Now