Article ID: 134621
Article Last Modified on 2/15/2000
IF TYPE ('This.Parent')= "0" && The object has a container
? This.Parent.Name
ENDIF
The following example illustrates this method using a command button. If
the control is placed in a toolbar, the Visible property of the toolbar is
set to false (.F.) when the button is released. To run this example, copy
and paste the code into a program (.PRG) file. When the toolbar is
displayed, click the Close button. The toolbar is hidden before it is
released.
PUBLIC oTB1,oFrm1 && Define public variables
oTb1=CREATE('tbmytool') && Create an instance of the toolbar object
oTb1.SHOW
oFrm1=CREATE('Frmmyform') && Create an instance of the form object
oFrm1.SHOW
DEFINE CLASS cmdQuit AS COMMANDBUTTON
PROCEDURE CLICK
RELEASE THISFORM && Release either the form or the toolbar
ENDPROC
PROCEDURE DESTROY && Called when the object is released
IF TYPE('This.parent')="O"
IF THIS.PARENT.BASECLASS="Toolbar"
THIS.PARENT.VISIBLE = .F. && Hides the toolbar
=MESSAGEBOX('Toolbar is hidden')
ENDIF
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS tbMyTool AS TOOLBAR
ADD OBJECT cmdNew AS COMMANDBUTTON
ADD OBJECT cmdClose AS cmdQuit
ENDDEFINE
DEFINE CLASS frmmyform AS FORM
ADD OBJECT cmdForm AS cmdQuit
ENDDEFINE
Additional query words: VFoxWin form set
Keywords: KB134621