<pascal>
bNotEditByState:=GetVar('IDSTATE_MC')>100;
bNotEditByState2:=GetVar('IDSTATE_MC')>200;
bNotEditByState3:=GetVar('IDSTATE_MC')=300;
bvEdit := (nvl(GetVar('bCanEdit'),0) = 1);
ObjNotExist := VarIsNull(GetVar('id'));
bvPlant := (GetSelfVar('bPlant') = 1);
bvProj := (GetSelfVar('bProj') = 1);
//selection.SetCustomDisable('ManageAcces', not bCanEditByRight);
selection.SetDisabled(dsoEdit, bNotEditByState or ObjNotExist);
selection.SetCustomDisable('SendToProjector', bNotEditByState or ObjNotExist or (not bvPlant) or (not bvEdit));
selection.SetFieldsReadOnly('STEXTQUESTION,SSUBJECT', bNotEditByState or (not bvPlant) or (not bvEdit) or ObjNotExist);
//selection.SetCustomDisable('Answer', bNotEditByState2 or ObjNotExist);
selection.SetCustomDisable('Answer', not bNotEditByState or bNotEditByState2 or bNotEditByState3 or ObjNotExist or (not bvEdit));
selection.SetCustomDisable('returnToPrjCons', (not bNotEditByState) or (not bNotEditByState2) or (not bNotEditByState3) or (not bvProj) or (not bvEdit));
selection.SetCustomDisable('returnToStateCreate', not bNotEditByState or bNotEditByState2 or bNotEditByState3 or (not bvPlant) or (not bvEdit));
selection.SetFieldsReadOnly('SANSWERTEXT', (not bNotEditByState) or bNotEditByState2 or (not bvEdit));
selection.SetFieldsReadOnly('SPROJECTORFIO,sPrjContras,idOfstructurePrj_HL,IDPROJECTOR_HL,IDOFSTRUCTURE_HL,idPerson_HL,DANSWERDATE,DCREATEDATE', true);
Selection.ExecOpScript('CheckOper');
//showMessage(varToStr(bNotEditByState)+'; '+varToStr(bNotEditByState2)+'; '+varToStr(bNotEditByState3));
Selection.CWADetails;
</pascal>