Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any reason to not use NewObject in form.Load()
Message
From
27/06/2003 15:01:54
 
 
To
27/06/2003 10:46:09
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00802482
Message ID:
00804833
Views:
32
>Hi Bill,
>
>>
>>form.load()
>>  if !dodefault()
>>    return .f.
>>  endif
>>  this.NewObject('myName','myClass')
>>  return this.myName.myMethod()
>>
>>Is there any reason I should not add an object to a form in the Load() method?
>
>Other than that the form object doesn't have a NewObject method and the code above won't run, I can't think of any *bg*
>If you have no need of the "myClass" object other than to determine whether the form should load or not you want
>
>
>LOCAL loX
>lox = NewObject("myName", "myClass")
>RETURN lox.myMethod()
>
>
>If you want to use methods of myClass at other times during the life of your form then you want to use AddObject.
>
>
>This.AddObject("myName", "myClass")
>
>
>pamela

Hi Pamela,
Forms do have a NewObject() method. As near as I can tell it's the same as the AddObject() method, except you can name the vcx file that the class is in, so it doesn't have to be in the Set Classlib.

I also assumed that NewObject method and NewObject function were the same thing, but someone here corrected me (Sergey I think). The method creates an object with a Parent (the form or other container), but the function creates an object with no Parent. The function needs a name to give to the new object, but the function doesn't.
Bill Morris
Previous
Reply
Map
View

Click here to load this message in the networking platform