Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Non-visual Class
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
CodeMine
Title:
Non-visual Class
Miscellaneous
Thread ID:
00659044
Message ID:
00659044
Views:
54
Question on non-visual classes with CodeMine 7.

I am converting some required program.prg code into a non-visual class. I should also say this is my first time ever doing this - and it is working perfectly. However, I need a little assurance I did this right - or perhaps to know of some "gotchas" that I overlooked.

The new class I used was based on "Custom." I assume this is correct (is it?), and I stored it within its own library titled "Complete." The first class within it is titled "copythis" and I have added three methods to it: copyitem, encrypt, decrypt. What this class does is encrypt a character string, save it to a .MEM file, and copy it to a diskette.

In this InitEvent() of the CopyThis class, I have this code:
THIS.copyitem()
I call this class from a CommandCustomButton on a form, and its click() is:

FUNCTION cmdcommandbutton.click
LOCAL oDialog

* Example of calling a class within a class library and the InitEvent
* will be used.
m.oQuickCop = NEWOBJECT('CopyThis','Complete')

RELEASE m.oQuickCop
And here is my question(s):

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

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

3 - I tested calling the class with the following code:
* Note: CLASSLIB would normally setup in AppMain.prg. This is for 
* example only.
SET CLASSLIB TO COMPLETE.VCX ADDITIVE
m.oQuickCop = CREATEOBJECT('CopyThis')
m.oQuickCop.CopyItem()


RELEASE m.oQuickCop
and it would bypass the InitEvent() and go right to CopyItem().

Is this just a matter of personal preference (or can NEWOBJECT be passed a parameter to also bypass the InitEven()?

Any suggestions or comments is greatly appreciated. I have probably a 100 of these I will be moving from a program.prg to a class, so I am trying to do all my homework up front on this one - and then apply this knowledge to the others.

Mel Cummings
Next
Reply
Map
View

Click here to load this message in the networking platform