Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Modal form loses focus
Message
De
25/02/1997 12:01:48
 
 
À
25/02/1997 10:02:40
Paul Wei
Fib, State of Michigan
Lansing, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00021756
Message ID:
00021955
Vues:
31
>>I have a VFP 5.0 application using only top level forms with SCREEN set to off. I have a top level, modeless form, Form1, with a menu instantiated in it. From the menu I call a top level, modal form, Form2. From Form2 I can call a third top level, modal form, Form3, from one of two buttons. One button calls Form3 to insert a new record into a table after the user has entered data. The second button calls Form3 to edit existing data in the table. The only difference in the call is in setup code in the INIT of Form3. When Form3 is called to edit data everything looks fine. When Form3 is called to insert a new record, Form3 appears briefly, then Form2 regains the focus over Form3. I thought a modal form retained focus until released or until it spawned another modal form. All forms have ALWAYSONTOP set to .F.. What am I missing here?
>>
>>Thanks,
>>Bill
>
>Bill,
>
>I had an application which opens a string of modal forms, one calling the next. I noticed that sometimes VFP got confused when I was backing out of this sequence of forms, i.e. after closing Form3, Form1 will pop to the front instead of Form2. I gave up trying to figure out why after awhile and went with a check in the ACTIVATE method of Form1 to see if Form2 exists. If Form2 exists when Form1 is being activated, I simply fireup Form2's SHOW method. On my next application, I gave up on chaining modal forms and went with modeless ones instead.
>
>Paul

Thanks for your response, Paul.

This is interesting. Edward, I tried your suggestion and it did not work for me. However, although I do not understand it, I tracked down the problem. First, I found out that TOP LEVEL forms, according to the HELP are always MODELESS. I declared them MODAL but was not able to use the TO clause in the DO FORM myform WITH myvariable TO myvariable. The system reported that the To clause can only be used with MODAL forms. Checking the HELP showed TOP LEVEL forms as always MODELESS. Since I couldn't use the TO clause, I referenced a variable in Form3 that had been created in Form2. No problem here, but when I change the value of the variable, focus is shifted back to Form2. Must be a scoping problem. When I do not modify the variable in Form3, focus remains on Form3. I then created a Property in my application object to replace the variable with so it will be global to the application. Strange, I set the value of the app. obj. var. in Form2, but when I modify the app. obj. var. in Form3, focus is still shifted to Form2. I now create a property in Form3 to temporarily hold the app. obj. var. value and modify the Form3 property, then reset the app. obj. var. to the Form3 property value in the UNLOAD of the form. I don't like the "hoops", but it does work. Perhaps this is "by design" and I am missing something, but I think this is a bug.

Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform