AddObject, NewObject, RemoveObject
These methods let you add and remove objects from containers, both at design-time and at runtime. You can add controls to a form or page or column, columns to a grid, pages to a page frame, buttons to a button group, and so on. And, of course, you can remove the ones that are already there.
Usage |
oObject.AddObject( cName, cClass [, cOLEClass ] [, uParamList ] ) oObject.NewObject( cName, cClass [, cClassLib [, cLibInApp [, uParamList ] ] ] ) oObject.RemoveObject( cName ) |
Parameter |
Value |
Meaning |
cName |
Character |
The name of the object to be added or removed. |
cClass |
Character |
The class of the object to be added. |
cOLEClass |
Character |
If cClass is "OLEControl", specifies the type of OLE object to add. |
uParamList |
List of expressions |
Parameters to be passed to the Init method of the new object. |
cClassLib |
Character |
The name of the file containing the class definition for cClass. |
Omitted |
Either cClass is a VFP base class or the class library has already been opened with SET CLASSLIB or SET PROCEDURE. |
|
cLibInApp |
Character |
The name (including extension) of an APP or EXE file containing cClassLib. |
Example |
oForm = CreateObject('Form') oForm.Show() * Choose one of the next two method calls. * This version assumes that the library file is in the * search path. oForm.AddObject('cmdClose',"CloseButton") * or you could avoid the issue this way: oForm.NewObject('cmdClose',"CloseButton","Buttons") oForm.cmdClose.Top = 100 oForm.cmdClose.Left = 50 oForm.cmdClose.Visible = .T. * Assume you have the equivalent of this definition in a * visual class in a file called Buttons.VCX DEFINE CLASS CloseButton AS CommandButton Caption = "Close" PROCEDURE Click ThisForm.Release() ENDPROC ENDDEFINE |
See Also |
AddItem, AddListItem, CreateObject, Define Class, Init, LockScreen, RemoveItem, RemoveListItem, Visible |