MDI child forms and control lost-focus events 
Author Message
 MDI child forms and control lost-focus events

I am involved in developing an application where forms contain text boxes with
lost-focus events. In this application. there is one MDI parent main menu form
and all the menu options load MDI children. The problem is this--if I have a
form displayed and a control containing lost-focus event code has the focus,
the lost-focus event fires when I open a second form without first closing the
first form. I'd like to be able to detect that the cause of the lost focus on
the current control is the opening of another form so I can trap it in the
code. I have tried using the GetActiveWindow API function and haven't had much
luck. I have heard that 3rd party custom controls like Spy Works might help,
but I won't be able to purchase them. Can anyone suggest an option that would
allow me to avoid changing all the MDI children to modal forms?

:: 32 bit VB4 running under NT 4.0.

Thanks,
Mike




Tue, 06 Jul 1999 03:00:00 GMT  
 MDI child forms and control lost-focus events

well if both windows are in the same mdi set - set a global variable
when your control loses focus - then arm a timer.   The form activate
for the other mdi child form will test for this global variable and
kill the timer if you don't want it to proceede.

The timer routine will fire after it times out actually doing the lost
focus processing - but the new form can shot stop it from
happening......  This I am sure is a cludgey way of doing things - but
I subscribe to the philosiphy- its right if it works.

Syd

Quote:

>I am involved in developing an application where forms contain text boxes with
>lost-focus events. In this application. there is one MDI parent main menu form
>and all the menu options load MDI children. The problem is this--if I have a
>form displayed and a control containing lost-focus event code has the focus,
>the lost-focus event fires when I open a second form without first closing the
>first form. I'd like to be able to detect that the cause of the lost focus on
>the current control is the opening of another form so I can trap it in the
>code. I have tried using the GetActiveWindow API function and haven't had much
>luck. I have heard that 3rd party custom controls like Spy Works might help,
>but I won't be able to purchase them. Can anyone suggest an option that would
>allow me to avoid changing all the MDI children to modal forms?

>:: 32 bit VB4 running under NT 4.0.

>Thanks,
>Mike





Wed, 07 Jul 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Non MDI child forms cause MDI application to lose focus

2. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

3. ActiveX controls on MDI child forms do not get focus properly

4. Developing OLE MDI Child forms displayed on Control MDI Form

5. MDI Form & Child Form Focus

6. Form close event occurs before lost focus event

7. Setting Focus to MDI Child forms

8. Focus on MDI Child forms?

9. MDI Child Form - hold focus??

10. MDI Child Form Looses Focus

11. Setting focus to the next mdi child form

12. Modifying object in MDI Parent form from MDI Child form

 

 
Powered by phpBB® Forum Software