Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The creature that won't die
Message
From
23/03/2010 18:22:22
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
23/03/2010 10:21:35
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
VFP Compiler for .NET
Miscellaneous
Thread ID:
01456123
Message ID:
01456808
Views:
79
>(just very simplistic, not tested)
>
>
FUNCTION AddObjectToContainer(cClassKey, oParent, cName)
>LOCAL oObject
>
>oObject = NULL
>
>IF !USED("MyFactoryClasses") 
>   USE MyFactoryClasses IN 0 ORDER ClassKey
>ENDIF
>
>IF SEEK(cClassKey, "MyFactoryClasses")
>    oParent.AddObject(cName,  MyFactoryClasses.ActualClass)
>***    oObject = oParent.&cName
   oObject=getpem(oParent, cName)
>ENDIF
>RETURN oObject
And you don't even need the macro. See my intervention above.

>When writing I don't have a clue what oParent is. It could be a form, a grid, a container, a toolbar, _screen. I don't know what type of object has been added to the form etc... I don't care here either.
>
>The point is however, that in particular cases you don't give a hoot about its type, because YOU AS A PROGRAMMER know that certain properties and methods do exist, and telling the compiler the same might be very difficult. This is the reason virtual classes and virtual methods exist. You'll have to bend everyhting into making the compiler happy because it wants to know all at compile time.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform