*************************************************************************** *&RS FUNCTION DOFORM *************************************************************************** * Purpose.....: Creates and shows forms, and returns values if appropriate * Parameters..: tcClassName -- name of form class to create * tuParm1 -- optional parameter to pass to form being created * Example.....: DoForm("TESTFORM") * Returns.....: result of CREATEOBJECT * Created.....: 2003.12.04 * History.....: Adapted from DOFORM by Paul Bienick in CodeBook ********************************************************************** function DoForm(tcClassName, tuParm1) local loObject local luRetVal close database all Trace_RS("DoForm--before CREATEOBJECT","PL") set classlib to LIBS\TESTLIB.VCX if PCOUNT() < 2 loObject = createobject(tcClassName) else loObject = createobject(tcClassName, @tuParm1) endif iif(glTrace_RS,Trace_RS("DoForm--before SHOW"), .f.) if type("loObject") == "O" and !isnull(loObject) loObject.show() if type("loObject.uRetVal") <> "U" luRetVal = loObject.uRetVal loObject.destroy() release loObject wait window "UNABLE TO CREATE " + tcClassName return luRetVal endif else iif(glTrace_RS,Trace_RS("DoForm--CREATEOBJECT failed " + tcClassName), .f.) endif iif(glTrace_RS,Trace_RS("DoForm--before READ EVENTS"), .f.) read events release loObject Trace_RS("Q") endfunc 63358.402 DS1 DoForm--before CREATEOBJECT 63360.726 DS1 TESTFORM.Load: testform 63360.726 DS1 TESTFORM.Init: testform 63360.726 DS1 DoForm--before SHOW 63360.726 DS1 TESTFORM.Show: testform 63360.736 DS1 TESTFORM.Activate: testform 63360.736 DS1 DoForm--before READ EVENTS 63360.746 DS1 TESTFORM.GotFocus: testformNote that TESTFORM is based on the FORM base class and there is no event code other than the calls to TRACE_RS.