Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>>I have a form. From it a user can click a button and a new form appears (I now have 2 forms showing). If the user hits cancel, the 2nd form goes away and they are at the original form. No problem. BUT, if the user selects a particular option, I want the first 2 screens to go away and call a 3rd screen. The part I can't get to work is for the first 2 screens to go away. I have tried every syntax and command I can think of, yet they are still there. These are modal forms. Hope that wasn't too confusing, any help appreciated.
>>Thanks,
>>Kevin
>
>Kevin,
>
>I will present the other option (to apply if this is the case). On the presumption you do not want the other form objects destroyed, and that none of the forms called are of formretval classes, I would use some application.properties... try this....
>
>Create application.form1 (L) and application.form2 (L) properties. .T. means the form exists.
>
>Create application.setnomode method
>
> application.setnomode()
> IF (application.form1 .OR. application.form2)
> lnObjects = AMEMBERS(laObjects, _SCREEN, 2)
> FOR lnCount = 1 TO lnObjects
> loObject = EVALUATE('THIS.' + laObjects[lnCount])
> ** We only want form objects
> IF UPPER(loObject.BaseClass) = 'FORM'
> ** Is this either form1 or form2
> IF INLIST(UPPER(ALLTRIM(loObject.Name)),'FORM1','FORM2')
> loObject.WindowType = 0
> ENDIF
> ENDFOR
> ENDIF
>
>Create application.hidemode method
>
> application.hidemode()
> IF (application.form1 .OR. application.form2)
> lnObjects = AMEMBERS(laObjects, _SCREEN, 2)
> FOR lnCount = 1 TO lnObjects
> loObject = EVALUATE('THIS.' + laObjects[lnCount])
> ** We only want form objects
> IF UPPER(loObject.BaseClass) = 'FORM'
> ** Is this either form1 or form2
> IF INLIST(UPPER(ALLTRIM(loObject.Name)),'FORM1','FORM2')
> loObject.Hide
> ENDIF
> ENDFOR
> ENDIF
>
>Create application.resetmode method
>
> application.resetmode()
> IF (application.form1 .OR. application.form2)
> lnObjects = AMEMBERS(laObjects, _SCREEN, 2)
> FOR lnCount = 1 TO lnObjects
> loObject = EVALUATE('THIS.' + laObjects[lnCount])
> ** We only want form objects
> IF UPPER(loObject.BaseClass) = 'FORM'
> ** Is this either form1 or form2
> IF INLIST(UPPER(ALLTRIM(loObject.Name)),'FORM1','FORM2')
> loObject.WindowType = 1
> loObject.Show
> ENDIF
> ENDFOR
> ENDIF
>
>OKAY... now run your forms.....
>
>
>do form form1
> In the form1.init of the form (after validation coding, etc...)
> application.form1 = .T.
>
>do form form2
> In the form2.init of the form (after validation coding, etc...)
> application.form2 = .T.
>2
>You now have your two forms. Now in the .click method of the 'option' you will use to call the third form up.....
>
>callform3.click
>
> IF (application.form1 .OR. application.form2)
> application.setnomode()
> ENDIF
> do form form3
>
>In the form3.init of the form (after validation coding, etc...)
> IF (application.form1 .OR. application.form2)
> application.hidemode()
> ENDIF
>
>In the form3.destroy.t of the form (after validation coding, etc...)
> IF (application.form1 .OR. application.form2)
> application.resetmode()
> ENDIF
>
>I don't have my VFP machine... you may have to move the .show call from the .resetmode... but all in all this should keep the forms well away from view while you work in that third screen.
>
>HTH
>
>Ric
>
<<<<<<>>>> Sorry, thought I had erased it....
> IF application.form1
> lnObjects = AMEMBERS(laObjects, _SCREEN, 2)
> FOR lnCount = 1 TO lnObjects
> loObject = EVALUATE('THIS.' + laObjects[lnCount])
> IF UPPER(loObject.BaseClass) = 'FORM'
> ** Is this either form1 or form2
> IF INLIST(UPPER(ALLTRIM(loObject.Name)),'FORM1','FORM2')
> loObject.WindowType = 0
> loObject.Hide
> ENDIF
> ENDFOR
> ENDIF
> RELEASE loObject, lnObjects
>
>
>form1.release
>form2.release
>
>release form1, form2
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement