Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Createobject() and returning a parameter
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00047277
Message ID:
00047684
Vues:
23
>Hi Darrel!
>
>Your solution is great! But I have 2 additional question:
>
>If the window is closeable and user clicks on the window close icon, in the next row, after the oForm.Show(), oForm is no longer exist, so I can decide which way was the form leaved by the user.(if type("oForm")="U" ...) Is It right?
>
>Is there any way, with I can decide - inside the formclass - whether the code is launched by Createobject or Do Form? Because what happens when the form is launched by Do form, and I issue only the hide() method. I think that in these cases I have to issue release() in the OK/Cancel click event?
>
>if
> Thisform.release()
>else
> Thisform.hide()
>endif
>

Hi Bela,

Ok, lets first address your closing issue. I believe that because it is a modal form, you can justify removing the close button from the window. If you do not want to do that you can put the following code in the Queryunload

NODEFAULT
thisform.Hide()

Now onto your second issue. It really does not matter whether you are doing DO FORM or using CREATEOBJECT, the real issue is the fact that you are using a modal screen. If you are using a modal screen you can always use thisform.Hide() and then Release the form in the calling program.

PROCEDURE ParentForm.LaunchChildForm
LOCAL loForm
loForm = CREATEOBJECT("ChildForm")
loForm.Show(1) && Modal Child form
lnRetVal = loForm.nRetVal
loForm.Release()
ENDPROC

In fact you even do not need the loForm.Release() at the end as long as you have not put any cleanup code in the release method. When the procedure ends the local variable will be destroyed and the form will be released automatically as there are no other references to it.

The much more tricky issue is returning a value from a modeless form. Many people will argue that you should never have to do this but I have found it useful in certain cases. If you are interested, let me know.

Darrel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform