Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CreateGlobalObject()
Message
De
19/06/2002 19:05:45
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Divers
Thread ID:
00670322
Message ID:
00670358
Vues:
29
Mel,

Creating a global object from inside of a form doesn't give me any warm fuzzy feelings. (for non-Codemine lurkers: it really creates an object that belongs to _SCREEN).

And I don't see how using CreateGlobalObject() can help here...what if you want to open two forms at the same time, with private data sessions? How can the your custom CDE contained within the screen be visible to both forms, and the forms have private datasessions, all at the same time? I digress...and maybe I'm off my rocker here...*grin*

How about adding a property to the form (let's call it oCdeCombos). Be sure your appStartArrays class is not marked to have a private data session.
* form load method
if dodefault()
    thisform.oCdeCombos = createobject("appStartArrays")
endif


* put this in form's unload method
thisform.oCdeCombos.release()   && or the files will be left open!
dodefault()                     && this releases the form's oCDE
Hope these thoughts help, and Gary can clean up my mess.

steve

>I am testing CreateGlobalObject() opening a table as follows:
>
>I have created a CDE titled "AppStartArrays" which has one table, and I am using it as stand-alone (not attached to a form). This table holds items for all ComboBoxes. I would like to make a call to open the table, then will build an array from the table to populate the ComboBox, etc. I stored "AppStartArrays" in the "AppMain" library, and I have "lAutoOpen" set to .T.
>
>Placing the following code in a ComboBox Init():
>
>
>m.oCDE=CreateGlobalObject('appstartarrays')
>BROWSE  && test just to see in the table in AppStartArrays is selected
>
>Shows that the table is opened, but in a different Data Session (by looking at the Data Session Window).
>
>Whereas:
>
>m.oCDE=CREATEOBJECT('appstartarrays')
>BROWSE  && test just to see in the table in AppStartArrays is selected
>
>Actually adds the table to the current datasession, and that table is selected.
>
>Using CREATEOBJECT() actually does what I need it to do, but CodeMine 7 OnLIne help suggested using CreateGlobalObject() for global, so that is the purpose of me testing all this here.
>
>I assume this is the normal behavior of CreateGlobalObject() and if so is there an easy way to have it open the table found in the "AppStartArrays?" within the current Data Session?
>
>Mel Cummings
Steve Gibson
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform