IF this.CurrentState = 'view' MySetAll(oApp.ToolbarRef.MainToolbarContainer , 'Enabled' , ; 'CmdNew,CmdEdit,CmdDelete,CmdSave,CmdRevert,CmdSearch,CmdPreview,CmdPrint,CmdPrintAll', ; '.t. ,.t. ,.t. ,.f. ,.f. ,.t. ,.f. ,.t. ,.f. ') ENDIF IF this.CurrentState = 'add' OR this.CurrentState = 'edit' MySetAll(oApp.ToolbarRef.MainToolbarContainer , 'Enabled' , ; 'CmdNew,CmdEdit,CmdDelete,CmdSave,CmdRevert,CmdSearch,CmdPreview,CmdPrint,CmdPrintAll', ; '.f. ,.f. ,.f. ,.t. ,.t. ,.f. ,.f. ,.t. ,.f. ') ENDIF DODEFAULT()Note : MySetAll is a UDF which take form or container reference, the property that will be changed , list of objects and a list of values and change the values.
function MySetAll LPARAMETERS toContainerRef, tcProperty, tcObjectList, tcValueList LOCAL ARRAY laObjectList[1], laValueList[1] LOCAL lnCnt, lnObjCnt, lnValCnt, lcPropRef, lcPropValue lnObjCnt = ALINES(laObjectList, tcObjectList, .f., ',') lnValCnt = ALINES(laValueList, tcValueList, .t., ',') IF lnObjCnt = 0 RETURN ENDIF IF lnObjCnt <> lnValCnt RETURN ENDIF FOR lnCnt= 1 TO lnObjCnt lcPropRef='toContainerRef'+'.'+laObjectList[lnCnt]+'.'+tcProperty lcPropValue = laValueList[lnCnt] IF TYPE(lcPropRef) = 'L' &lcPropRef = &lcPropValue ENDIF IF TYPE(lcPropRef) = 'C' IF TYPE(lcPropValue) = 'U' &lcPropRef = lcPropValue ELSE &lcPropRef = EVALUATE(lcPropValue) endif ENDIF IF TYPE(lcPropRef) = 'D' lcPropValue = '{'+lcPropValue+'}' &lcPropRef = &lcPropValue ENDIF IF TYPE(lcPropRef) = 'N' &lcPropRef = VAL(lcPropValue) ENDIF NEXT>Hi,