statement is only valid within a class definition>
Member cmdEmp1 is a class member.>
> PROCEDURE ReleaseButtons > * releases all the lot and employee buttons > LOCAL x > FOR x= 1 TO THISFORM.CONTROLCOUNT > IF UPPER(THISFORM.CONTROLS[x].CLASS)$'CMDLOTACTIVE,CMDLOT,CMDEMPLOYEE' > REMOVEPROPERTY(THISFORM, THISFORM.CONTROLS[x].NAME) > ENDIF > ENDFOR > ENDPROC > >If you are hard coding the buttons to remove then I don't think you need to cycle through the controls. You might try something like
PROCEDURE ReleaseButtons * releases all the lot and employee buttons IF VARTYPE(thisform.cmdlotactive) = "O" thisform.removeobject("cmdlotactive") thisform.addobject("cmdlotactive","myclass") ENDIF IF VARTYPE(thisform.cmdlot) = "O" thisform.removeobject("cmdlot") thisform.addobject("cmdlot","mysecondclass") ENDIF etc ENDPROCIf you have more buttons than just the sample you could, for example, create a two dimensional array. The first column has the name of the control to remove. The second column has the name of the class used to replace it. Thus, in the form's Init method
DIME Thisform.aRemoveButtons[3,2] aRemoveButtons[1,1]='CMDLOTACTIVE' aRemoveButtons[2,1]='CMDLOT' aRemoveButtons[3,1]='CMDEMPLOYEE' aRemoveButtons[1,2]="myClass1" aRemoveButtons[1,2]="myClass2" aRemoveButtons[1,2]="myClass3"and then.....
PROCEDURE ReleaseButtons * releases all the lot and employee buttons FOR I = 1 TO ALEN(thisform.aRemoveButtons,1) IF TYPE(aRemoveButtons[I,1]) = "O" thisform.removeobject(aRemoveButtons[I,1]) thisform.addobject(aRemoveButtons[I,1],aRemoveButtons[I,2]) ENDIF NEXT ENDPROC >Bear in mind that myClass1,2,3, etc. have to be classes defined in an open procedure. There may be (probably are) other, better, ways of doing this but I'm pretty sure something like this will work (but the code has only been mildly tested and may need some tweaking)