Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you make an MDI form take focus away from a component?

Status
Not open for further replies.

ThomLemon

Programmer
Oct 18, 2001
3
0
0
US
I have an MDI application with a page control that has edit boxes and spin edits on several of the tabs. I use the FormKeyDown method of the childwin unit to handle keyboard inputs but when the user clicks in an edit box on a tab on the page control, it never gives the focus back to childwin so the key strokes never get handled. I have tried calling ActiveMDIChild.SetFocus; in the Main form but it has no effect.

Does anyone have any solutions?

Thom Lemon
 
Hi ThomLemon,

In the mdi child form itself try setting in each components
OnEnter event self.SetFocus

BobbaFet Everyone has a right to my opinion.
E-mail me at cwcon@programmer.net
 
Actually, there are no components on the child. I pass the handle to the window to a set of Cadd routines that allow me to draw within it. The work around I have come up with is to set a timer so that after a few seconds have passed I open and close a dialog box which is never seen but doing so forces focus back to the active child. Doing an ActiveMDIChild.SetFocus should have done what I wanted but it had no effect.
Thanks for your help.
Thom
 
How about using the TForm.Activate method instead of setfocus?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top