Board index » delphi » Prevent MDI Child from losing a focus

Prevent MDI Child from losing a focus

Hi Delphians !

I have MDI application and one of the childs window has dbedit components
with "range checks". I wanna check this range if user change input focus to
other mdi child window. I found event "OnDeactivate" and check works OK
exept one thing - if value of dbEdit is out of range I got Error message but
I can't stay into old window ! Input focus changes to new window everytime !

Dmitry

 

Re:Prevent MDI Child from losing a focus


Quote
> I have MDI application and one of the childs window has dbedit components
> with "range checks". I wanna check this range if user change input focus to
> other mdi child window. I found event "OnDeactivate" and check works OK
> exept one thing - if value of dbEdit is out of range I got Error message but
> I can't stay into old window ! Input focus changes to new window everytime !

Dmitry,

if using the Sysutils.Abort procedure to raise a silent exception does not
stop the focus change do this in the OnDeactivate handler to move focus back
to the current child form:

  PostMessage( application.mainform.clienthandle,
               WM_MDIACTIVATE,
               handle,
               0 );

It will cause some flicker but at least you get back to the right child
window.

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Other Threads