PROCEDURE lIsPemEditorInstalled LOCAL lResult, nArea nArea = SELECT(0) USE (_FOXCODE) IN 0 AGAIN SHARED ALIAS MODFOXCODE SELECT MODFOXCODE LOCATE FOR (MODFOXCODE.TYPE = [M]) AND (ALLTRIM(MODFOXCODE.ABBREV) = [24460]) AND ; ("PEMEDITOR.APP" $ UPPER(DATA)) lResult = FOUND() * Close table USE IN SELECT([MODFOXCODE]) SELECT (nArea) RETURN lResult* Dis/Enable Pem Editor by deleting or restoring the corresponding FoxCode records
#include "i:\Vfp9\Prj\Utl\3rdTools\PEM editor\Source\EditPropertyDialog.H" PROCEDURE uSetPemEditor(lEnable) LOCAL nArea, cSetDeleted, nLen, nAbbrev, nFound, nRec, nCount nArea = SELECT(0) cSetDeleted = SET("Deleted") nLen = 4 DIMENSION aAbbrev(nLen) aAbbrev[1] = [24460] aAbbrev[2] = [EDIT PROPERTY/METHOD...] aAbbrev[3] = UPPER(ccLOC_MENU_NEW_PROPERTY) aAbbrev[4] = UPPER(ccLOC_MENU_NEW_METHOD) USE (_FOXCODE) IN 0 AGAIN SHARED ALIAS WORKING ORDER 1 SELECT WORKING IF lEnable IF [O] = TYPE([_oPEMEditor]) uPop([Pem Editor is already enabled!], "W") ELSE * If more than 1 set of PemEditor's entries are found deleted in * FoxCode, RECALL only the lastest SET ORDER TO SET DELETED OFF nFound = 0 nCount = 0 FOR nAbbrev = 1 TO nLen nRec = 0 GO TOP LOCATE FOR (aAbbrev[nAbbrev] = ALLTRIM(WORKING.ABBREV)) AND ; ("PEMEDITOR.APP" $ UPPER(DATA)) DO WHILE !EOF() AND FOUND() nFound = 1 + nFound IF DELETED() nRec = RECNO() ENDIF SKIP 1 LOCATE FOR (aAbbrev[nAbbrev] = ALLTRIM(WORKING.ABBREV)) AND ; ("PEMEDITOR.APP" $ UPPER(DATA)) REST ENDDO IF !EMPTY(nRec) GO RECORD nRec RECALL nCount = 1 + nCount ENDIF NEXT IF EMPTY(nFound) * PemEditor's FoxCode record not found uPop([Pem Editor is not installed!], "E") ELSE IF EMPTY(nCount) * PemEditor is already enabled uPop([Pem Editor is already enabled!], "W") ELSE IF [O] <> TYPE([_oPEMEditor]) * Launch the pemeditor DO i:\Vfp9\Prj\Utl\3rdTools\PEM editor\StartPEMEditor.PRG * Tab dock PemEditor to Property window on the left DOCK NAME _oPEMEditor POSITION 4 WINDOW Properties ENDIF uPop([Pem Editor is now enabled!]) ENDIF ENDIF ENDIF ELSE IF [O] = TYPE([_oPEMEditor]) RELEASE _oPEMEditor ENDIF SET DELETED ON nCount = 0 FOR nAbbrev = 1 TO nLen IF SEEK([M] + aAbbrev[nAbbrev]) AND ("PEMEDITOR.APP" $ UPPER(DATA)) nCount = 1 + nCount DELETE ENDIF NEXT IF EMPTY(nCount) * PemEditor is already Disabled uPop([Pem Editor is already disabled!], "W") ELSE uPop([Pem Editor is now disabled!]) ENDIF ENDIF USE IN SELECT([WORKING]) SELECT (nArea) SET DELETED &cSetDeleted>BTW, I was thinking - what would happen if you try to convert VPMDataHandler into prg and both Dev and Pro to prg as well? Would PEMEditor still choke on this class?