I hope I can help
Creating a class is very simular to creating a form
type create class hit enter.
Create a class from a form.
resize it so it is small you won't be using it for an interface.
add methods and properties to it.
in the init method open the table you want.
call another method (you create) that will add the field you need.
When applying this to a form drop it on a form then you can get a littl more custom in your coding to the form you have droped it on.
eg.
You want to create an invoice form.
Create an invoiceObj (Invoice object described above)
create a form.
Drop an instance of the InvoceObj Object on the Invoice Form using the class browser.
Edit your properties and methids to work with the form, and load an environment.
eg. a good method may be AddInvoice()
call that Object to InvoiceObj1.AddInvoice(). Have this method do what it need to do to add edit and delete your invoice table.
This will give you a three tier design (try using views to write to your data)
or instead of dropping it on a form
You can instansiate that objec into memory. (this is what I think you are looking for, but the above information should give you a good feel for proper use of classes.
create a variable oTest (the 'o' stands for object
public oTest
* lets say you called it CreateFields
*in the CreateFields class you have some properties called cAlias, cFieldName
*and a method called Createfield()
* create that object in memory
This will work if you have a set library to
oTest=createObject(CreateFields)
*The methods and properties you created above are now in oTest
*fill your properties
otest.cAlias = "Customer"
otest.cFieldName = "Address2"
* run the method
otest.CreateField()
The method should look somehting like this:
id !used(this.calias)
use (this.calias) exclusive
then do what you need to to add the field using the field name oTest.cFieldName
you can have the alias name and field name be parameters I just wanted to give you an idea of how this stuff works.
eg
* call the method like this
oTest.CreateFields("Customer","Address2")
* the code would look like this
lparameters pcAlias, pcFieldName && (The p stands for Param and the c for char)
use (pcalias) Exclusive And so on...
How is that for detail?
Mike Baty
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement