Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclass class in PRG file
Message
 
 
To
22/06/2018 08:44:43
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01660806
Message ID:
01660829
Views:
61
>>>Of course, one could argue if your subclass shouldn't be looking for a form in its class hierarchy, and only issue Thisform when it found one.
>>
>>Thank you, Antonio. For now I will leave the code with "thisform" in a method of this class (since it works). But when time permits I will see if I can review/change this. Just FYI, this is a class that connects to FTP for a file download. And the form has a progress bar. So the class (via updatebuffer method) calls the progress bar to update and show the progress.
>
>The difference is that createobject() and newobject functions will create standalone objects, while .addobject() and .newobject() methods of a form or any of its members which have those methods will create a member object in form's containership hierarchy. Member objects have .parent objects, and ultimately up this hierarchy there would be a form which can be referenced as thisform. Unless, of course, your top container object is something else (custom, session etc).

Thank you. This is what I did: thisform.NewObject( "myObjectName", "myClass", "ClassLocation.prg"). And my understanding is that since I used the form NewObject() method I don't have to explicitly destroy (set to NULL) the object myObjectName when releasing the form.

I also plan to modify my class (probably today) using the approach described by Tamar where the parent form will be passed to the class. Instead of referencing the form (thisform) in the class method.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform