Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Add methods to a class based on field values
Message
From
06/01/2005 11:14:50
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Add methods to a class based on field values
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00974698
Message ID:
00974698
Views:
52
I have a class that I created named sysinfo of atisysinfo.vcx based on the container class.

I have a table named sysinfobld that contains these fields:

csubitem c(50)
mmethod M

csubitem contains a character value such as config file, ip address, login, etc. Mmethod contains the procedure code that returns a value. The return value is always a character expression. I step through the table and for each value in csubitem I issue:

m.newvalue = EXECSCRIPT(mmethod)

Then I store m.newvalue in a memo field of another table which is displayed in a treeview.

Instead of using a table, I want to create methods in my class where the method name is the value in csubitem and the code is from mmethod. I would like to programmatically step through the table (in development) to modify the class something like:
oSysInfo = NEWOBJECT('SysInfo', 'ATISysInfo.vcx')
SELE sysinfobld
SCAN
   IF !PEMSTATUS(osysinfo,sysinfobld.csubitem,5)
      ADDPROPERTY(osysinfo,sysinfobld.csubitem,'')
   ENDIF
   *--Now store the value in the memo field mmethod to the class method
   *--?
ENDSCAN
Then in the runtime, I can call the methods in the class instead of executing the code in the memo field and the table will no longer be used. The table was used for gathering the functions in one place during research/testing. However, what is the correct syntax to do this? can it be done?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Next
Reply
Map
View

Click here to load this message in the networking platform