>I haven't played with creating classes by program code much. How would I add a class created with "define class xxx as custom" to a class library. I have created the class by code but I would like to add it to a class library.
>
>I didn't see much on that in the help or other places I looked at.
>
>
>Thanks in advance
>Gaylen
VFP just recently began to "require" a VCX to add OCX to our projects.
1) The first thing to do would be to create the VCX. With most OCX your class in CREATE CLASS dialog would be "based" on the "Olecontrol". I typically drop an empty visual OCX control on a form to assure I have the "based on"
class name correct.
For an imagelist control (VCX File), I would name it "vcxImageList.VCX". All you have to to is create a class based on an Olecontrol - you don't need to edit the VCX. Let the PRG code define the OCX for it's particular space. You could have one treeview OCX defined in one VCX, that you would use [that] as a base class for all the treeviews in your project through ADDOBJECT. One VCX for all subclasses.
2) In your PRG you would define your class based on the name you assigned in CREATE CLASS:
DEFINE CLASS ocxImageList as vcxImageList OF vcxImageList.vcx
ENDDEFINE &&IL
I typically name the class the same as the VCX fileNow you have a "class" that a VFP "Addobject" method can add to a container class (like a form).
3) Then add it to a container. For an Image List Control - since all the [other] OCX(s) will "share" it's images (like toolbars, treeviews, listviews, etc) - I would (typically) add it to my main form (a form I know
that will always be open). If I was subclassing a treeview, I would typically associate with a procedure file that serviced the particular form the treeview is on. Addobject has to be called - (I usually call these in guys in an init procedure):
PROCEDURE AddImageList(oform)
oform.ADDOBJECT('IL','ocxImageList') && the subclassed name is "IL"
WITH oform.IL
.IMAGEHEIGHT=18
.IMAGEWIDTH=18 && 18
.LISTIMAGES.ADD(1,"SAVE",LoadPicture(ucImageFolder+"SAVE.BMP")) && 1
.LISTIMAGES.ADD(1,"HELP",LoadPicture(ucImageFolder+"HELP.BMP")) && 1
ENDWITH
ENDPROC
HTH
Imagination is more important than knowledge