Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PUBLIC variables won't work when i call in the form
Message
De
16/01/2002 10:02:00
 
 
À
15/01/2002 18:04:33
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00604937
Message ID:
00605371
Vues:
25
>PUBLIC variables won't work when i call in the form. why is it that all the public variable that i declared in the main program will be missing in the form. here's my code.
>
>***Main.Prg
>PUBLIC oMyObject
>SET CLASSLIB TO myClass
>oMyObject = CreateObject("App")
>oMyObject.Init()
>DO FORM MyForm
>
>
>***MyForm.Scx
>
>*Init Method at myform.scx
>WAIT WINDOW oMyObject.MyText
>

The only thing I see wrong with your code is that you are calling oMyObject.Init() twice (once in the CreateObect, and once explicitely with oMyObject.Init())

I suggest you check these three things: 1) Check that you haven't done some sort of RELEASE, CLEAR ALL, etc. 2) Also, check that you haven't called another function with a reference to your object and that that function is not still executing - this will definetly cause a problem. 3) Check that your object has infact been created -- TYPE("oMyObject")="O"

This works for me - (and it's basically the same as you have done) So - the problem is not in the code you've posted.

***Main.Prg
PUBLIC oMyObject

oMyObject = CreateObject("TextBox")
oMyObject.Tag = "Here"

MyForm = CreateObject("MyFormClass") &&will run init and wait window
MyForm.Show()

DEFINE CLASS MyFormClass AS form

DoCreate = .T.
Caption = "Form1"
Name = "Form1"

PROCEDURE Init
WAIT WINDOW oMyObject.Tag
ENDPROC

ENDDEFINE
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform