Solved

is there a onfocus procedure for forms?

Posted on 1998-02-17
10
395 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

21 Experts available now in Live!

Get 1:1 Help Now