Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can you declare a FORM public?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00044717
Message ID:
00044762
Vues:
39
>>>>>>I need to get access to a object this is in a FORM that is not active.
>>>>>
>>>>>You can reference any form ("active" or "inactive", btw I don't know what you mean here), the only thing that this form must be loaded.
>>>>
>>>>If you have these FORMS loaded.
>>>>form1
>>>>form2
>>>>form3
>>>>and... you are in form1, but you want to access objects in form2 and form3,
>>>>what would the the code look like.. code sample please.
>>>
>>>Rob, it's the same code as you got from previous thread (about Form.Release).
>>
>>OK - so you are saying that I can
>>_SCREEN.anyform.RELEASE or
>>_SCREEN.anyform.grid1.visible=.t. or
>>_SCREEN.anyform.commandbutton.enabled=.f.
>>
>>provided I...
>>do form myform name anyform
>>
>>Is that right?
>The general gist of a lot of your questions lately seems to be that you want to manipulate forms and their objects from other forms, without putting them all in a formset, which is reasonable, but FoxPro doesn't seem to make it easy. I've been trying to do the same thing lately. In my case, I'm DOing FORMs from other forms, hiding the forms I came from, and then .Showing them again when I exit the second form, making a big form tree structure. It's easy when you have a simple app with no menu and no READ EVENTS: just make all the forms modal. You are probably finding, as I am, that these form object names seem to go out of scope when you are more than one form away, even though you used the NAME clause of DO FORM. To me, it looks like if you DO FORM form2 from form1, and DO FORM form3 from form2, you lose the object reference to form1 when you reach form3. Anyhow, the default form object name is supposed to be the name of the .scx, so DO FORM myform and DO FORM myform NAME myform
>should be equivalent (somebody please tell me if they're not). I don't understand why, but even though _SCREEN.myform doesn't seem to help with scope, you can always do as we've been advised and loop through _SCREEN.Forms(x), for x = 1 to _SCREEN.Formcount, looking for _SCREEN.Forms(x).Name = yourformname, which is the name property of your form as seen in your form designer, and not the form object name.
>
>As soon as I formulate the question in my mind better, I plan on making a new thread in which I ask about the best OOP way to manipulate all the forms in my app. It probably has to do with keeping properties in the application object to keep track of them. DOing FORMs from other forms, tree style as I do, is different from ol' TASTRADE and can pile up forms in memory.

When I started to look at Visual Fox two years ago, I formulated about the same questionnaire, see that it's too long and decided to use Formsets. I still use them, and believe me, they are very good and simple to handle (truly OO referenced). Actually, I use empty formset (containing toolbar only) and add forms (addobject from class) dynamically.
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform