*-- ReleaseDataEnvironment() *-- CHANGE - JCM - November 17, 2000 - 21:29:30 *-- Have a cleaner appearance IF thisform.LockScreen = .F. thisform.LockScreen = .T. ENDIF THISFORM.KillClassObject( 'CIFVIEWCOMBOBOX', THIS) *-- CHANGE - JCM - November 17, 2000 - 21:29:13 *-- son de la misma raza... THISFORM.KillClassObject( 'CIFCOMBOBOX', THIS) *** EGL: 3/27/98 - Changed this to a more direct test ** IF TYPE("This.oDataEnvironment") == "O" AND !ISNULL(This.oDataEnvironment) IF TYPE("This.oDataEnvironment.Name") == "C" This.oDataEnvironment.Release() ENDIF RETURN *--- *---------------------- Location Section ---------------------- * Library...........: * Class.............: Cbaseform * Method............: *-------------------------- Copyright ------------------------- * Author............: José Constant * Project...........: SOAS * Created...........: 17/11/2000 21:50:09 * Copyright.........: (c) Constant Software Systems , 2000 * Compiler..........: Visual FoxPro 06.00.8862.00 for Windows *----------------------- Usage Section ------------------------ *) Description.......: Kills a control based on its class. * : Based on the FindControlSourceObject by Doug Hennig, modified by Bernhart Milcent and * : Claudio Daniel Campos * : Uses recursion to kill every control included in container objects * : Usefull for pesky objects like cifCombos and their siblings that produce the unfamous * : 'Cannot access selected table' error message. * Scope.............: * Parameters........: *$ Usage.............: *% Example...........: * Returns...........: *------------------- Maintenance Section ---------------------- *@ Inputs:...........: * Outputs...........: * Pre-condt. invar..: * Post-condt.invar..: *? Notes.............: None * Collab.methods....: None *--Process...........: * Change log........: *-------------------------------------------------------------- LPARAMETERS tcClass, ; toObject LOCAL loContainer, ; lcField, ; laMembers[1], ; lcObject, ; loObject, ; lcClass, ; lcBaseClass * If we were passed a container, use it. Otherwise, use the form as the * container to drill down into. loContainer = IIF(pcount() = 1, THIS, toObject) lcClass = UPPER(tcClass) *-- CHANGE - JCM - November 17, 2000 - 20:24:05 *-- If the control is an ActiveX, return a .NULL. *-- Otherwise we'd get an error IF UPPER( toObject.CLASS) # "OLECONTROL" * Get a list of members in the container, then check each one. AMEMBERS(laMembers, loContainer, 2) *-- This line added by Bernhart Milcent IF TYPE("laMembers[1]") = "C" FOR EACH lcObject IN laMembers loObject = EVALUATE('loContainer.' + lcObject) lcBaseClass = UPPER(loObject.BASECLASS) DO CASE CASE UPPER(loObject.PARENTCLASS) == lcClass *-- kill it loObject.RELEASE loObject = .NULL. * For container classes, call ourselves recursively so we drill down into the * container. CASE lcBaseClass $ 'PAGE,PAGEFRAME,CONTAINER,GRID,OPTIONGROUP, COLUMN' THIS.KillClassObject(tcClass, loObject) OTHERWISE *-- nothing ENDCASE NEXT loObject ENDIF ENDIF RETURNJosé