CLOSE ALL CLEAR ALL RELEASE ALL CLEAR ON ERROR DO errprg WITH ERROR() SET SAFETY OFF SET CONFIRM OFF LOCAL lcnewvalue && line of code to add to the method lcnewvalue = "SET EXCLUSIVE OFF" && Add this line to the end of the method =ADIR(myforms,'c:\forms\*.scx') && directory of forms FOR i = 1 TO ALEN(myforms,1) && step through each form lcorgvalue = '' lcreplvalue = '' CLOSE ALL IF FILE('c:\forms\'+myforms(i,1)) lcfile = 'c:\forms\'+ LEFT(myforms(i,1),AT('.',myforms(i,1))-1) ?lcfile TRY lccommand = "MODIFY FORM "+lcfile+" NOWAIT" && specify the form to modify ?lccommand &lccommand TRY ASELOBJ(laform, 1) loform = laform(1) IF TYPE('loForm') = "O" .AND. !ISNULL(loform) .AND. ALLTRIM(UPPER(loform.BASECLASS)) = "FORM" ; .AND. UPPER(PEMSTATUS(loform,'LOAD',3)) = "EVENT" ; .AND. UPPER(loform.NAME)<>"SCREEN" lcorgvalue = loform.READMETHOD('LOAD') lcorgvalue = NVL(lcorgvalue,'') lcorgvalue = STRTRAN(lcorgvalue,[CHR(13)chr(13)],CHR(13)) ?lcorgvalue IF TYPE(lcORgValue) = "C" .and. LEN(lcORgvalue) < 255 .and. ! "SET EXCLUSIVE OFF" $ UPPER(lcorgvalue) lcreplvalue = lcorgvalue+CHR(13)+ALLTRIM(lcnewvalue)+CHR(13) ?lcreplvalue IF loform.WRITEMETHOD('LOAD',lcreplvalue) lcnewvalue = loform.READMETHOD('LOAD') ? lcnewvalue + " ---->>>> ************* SUCCESS ****************" CLEAR TYPEAHEAD INKEY(.1) KEYBOARD '{CTRL+W}' KEYBOARD CHR(121) DOEVENTS IF LASTKEY() = 27 EXIT ENDIF ELSE ? "Error writing method to "+myforms(i,1) ENDIF ENDIF ELSE ? myforms(i,1)+' form is not an object' ENDIF CATCH ? 'Error accessing '+myforms(i,1)+' as a form' ENDTRY CATCH ? ' Unable to modify '+myforms(i,1) ENDTRY ELSE ? myforms(i,1)+ ' is not a file.' ENDIF IF LASTKEY() = 27 EXIT ENDIF ENDFOR CLOSE ALL CLEAR ALL RETURN PROCEDURE errprg LPARAMETERS errnum ?"Error: " ??errnum RETURNAdd a line to the interactivechange method of all controls on a form:
CLOSE ALL LOCAL lcnewvalue && line of code to add to the method lcnewvalue = "THISFORM.isupdated = .T." && Add this line to the end of the method *--Form with controls to modify in this example is testform.scx *--This example modifies the interactivechange method of every combobox, textbox, editbox and listbox on form MODIFY FORM c:\FORMS\testform NOWAIT && specify the form to modify ASELOBJ(laform, 1) loform = laform(1) IF TYPE('loform.pageframe')<>"U" && our pageframes are always named pageframe, check for pageframe1, etc. FOR EACH lopage IN loform.PAGEFRAME.PAGES lcorgvalue = "" lcreplvalue = "" FOR EACH ocontrol IN lopage.CONTROLS IF ALLTRIM(UPPER(ocontrol.BASECLASS)) = "TEXTBOX" .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "EDITBOX" ; .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "COMBOBOX" ; .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "LISTBOX" lcorgvalue = ocontrol.READMETHOD('InteractiveChange') lcreplvalue = lcorgvalue+CHR(13)+ALLTRIM(lcnewvalue)+CHR(13) ocontrol.WRITEMETHOD('InteractiveChange',lcreplvalue) ENDIF ENDFOR ENDFOR ELSE && no pageframe all controls are on the single page FOR EACH ocontrol IN loform.CONTROLS lcorgvalue = "" lcreplvalue = "" IF ALLTRIM(UPPER(ocontrol.BASECLASS)) = "TEXTBOX" .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "EDITBOX" ; .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "COMBOBOX" ; .OR. ALLTRIM(UPPER(ocontrol.BASECLASS)) = "LISTBOX" lcorgvalue = ocontrol.READMETHOD('InteractiveChange') lcreplvalue = lcorgvalue+CHR(13)+ALLTRIM(lcnewvalue)+CHR(13) ocontrol.WRITEMETHOD('InteractiveChange',lcreplvalue) ENDIF ENDFOR ENDIF WAIT WINDOW "Verify the changes." NOWAIT RETURN