Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Non-visual Class
Message
From
20/05/2002 16:43:00
 
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00659044
Message ID:
00659097
Views:
26
>The new class I used was based on "Custom." I assume this is correct (is it?)

Many non-visual classes are based on Custom. However, it is not the only base class that you can use.

>and I stored it within its own library titled "Complete."

I personally have never used a VCX for non-visual classes. I would always use a .PRG for a non visual class. You have way more flexibility IMHO.

>1- I assume using NEWOBJECT instead of CREATEOBJECT is OK with CodeMine 7. Correct?

Yes, its OK. The main advantage of NewObject is that you can specify the class library so, you don't need it to be opened first. However, in Codemine, if you add a VCX to a project, Codemine adds it to the list of classes to open at startup, automatically.

>2- If I am finished with the "m.oQuickCop" object, I do need to release it... correct?

Well you can release it if you want. However, you have defined it as local and it is in the click method of a button. The minute the click method finishes, the variable will go out of scope. The "local" variable is only alive for as long as the procedure that calls it. So really, whilst it is "tidy" to release it, you don't need to.

>and it would bypass the InitEvent() and go right to CopyItem().

If your Init code calls CopyItem(), then instantiating the object by createobject should still fire your CopyItem() method. In this respect, there is no difference between Create/NewObject().

Personally, unless there is a good reason, I would probably not call another method from the Init event. This can make your object less flexible. You may build other methods into your object. One day you may want to call another method but not CopyItem(). However, by instantiating the object, it will automatically call CopyItem() from the Init. So, it might be better to just allow Create/Newobject to instantiate your object and return a reference to it. Then call the methods you want to use in whatever order the situation demands.

HTH
-=Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform