Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GETPEM() in VFP 6.0 is NOT SUPORTED IN RUN TIME
Message
From
05/10/1998 02:34:05
 
 
To
04/10/1998 13:39:14
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00143709
Message ID:
00143785
Views:
30
>VFP 6.0 does NOT support GETPEM() in modality RUN-TIME !. For me thi is a disaster becouse i have a lot of classese wich (in RUN TIME of course ) look up for the code in method/event. For example I'm looking if "SET ORDER" is in DblClick Of a HEADER (if .T. I change the ForeColor).
>Can anybody HELP ME with a Function/class wich can return a logical value if a string is foun in event's code (of course in RUN TIME)
>THANK YOU ALL !


I didn't know GETPEM() was broken for VFP 6.0 at runtime. Until there is a new release with it fixed, I suggest you use a utility I wrote as a work around. It's even designed to automatically use GETPEM() when it does work. It simply tests for an empty string, and then opens the related VCX automatically and returns the method code.

I posted it at http://www.classx.com/tools/getmethod.prg

The source code is below:
*  Program...........: GetMethod.PRG
*  Author............: Ken R. Levy
*  Created...........: 10/04/1998
*  Description.......: Gets method code GEMPEM() for VFP 6.0 due to product bug in returning
*					   method code at runtime.  Supports VCX based classes, not SCX forms.


*-- ASCII codes
#DEFINE TAB			CHR(9)
#DEFINE LF			CHR(10)
#DEFINE CR			CHR(13)
#DEFINE CR_LF		CR+LF


LPARAMETERS tvSource,tcMember
LOCAL oObject,lcMember,lcCode,lcMethods,lcSearchStr
LOCAL lcClass,lcClassLibrary,lnAtPos,lnLastSelect

IF NOT INLIST(VARTYPE(tvSource),"O","C") OR (VARTYPE(tcMember)#"C" OR EMPTY(tcMember))
	RETURN ""
ENDIF
lcMember=LOWER(ALLTRIM(tcMember))
IF VARTYPE(tvSource)=="O"
	oObject=tvSource
	lcCode=GETPEM(oObject,lcMember)
	IF NOT EMPTY(lcCode)
		RETURN lcCode
	ENDIF
	lcClass=LOWER(oObject.Class)
	lcClassLibrary=LOWER(oObject.ClassLibrary)
	IF EMPTY(lcClassLibrary)
		RETURN ""
	ENDIF
ELSE
	IF EMPTY(tvSource)
		RETURN ""
	ENDIF
	lcClass=ALLTRIM(tvSource)
	lnAtPos=AT(",",lcClass)
	IF lnAtPos>0
		lcClassLibrary=LOWER(ALLTRIM(MLINE(LEFT(lcClass,lnAtPos-1),1)))
		IF NOT "."$lcClassLibrary
			lcClassLibrary=lcClassLibrary+".vcx"
		ENDIF
		lcClass=LOWER(ALLTRIM(SUBSTR(lcClass,lnAtPos+1)))
		IF NOT FILE(lcClassLibrary)
			RETURN ""
		ENDIF
	ENDIF
ENDIF
IF NOT FILE(lcClassLibrary)
	RETURN .F.
ENDIF
lnLastSelect=SELECT()
SELECT 0
USE (lcClassLibrary) AGAIN SHARED
LOCATE FOR LOWER(ALLTRIM(ObjName))==lcClass AND UPPER(ALLTRIM(Platform))=="WINDOWS"
IF EOF() OR EMPTY(Methods)
	USE
	SELECT (lnLastSelect)
	RETURN ""
ENDIF
lcMethods=CR_LF+ALLTRIM(Methods)+CR_LF
USE
SELECT (lnLastSelect)
lcSearchStr=CR_LF+"PROCEDURE "+lcMember+CR
lnAtPos=AT(lcSearchStr,lcMethods)
IF lnAtPos=0
	RETURN ""
ENDIF
lcCode=SUBSTR(lcMethods,lnAtPos+LEN(lcSearchStr)+1)
lcSearchStr=CR_LF+"ENDPROC"+CR_LF
lnAtPos=AT(lcSearchStr,lcCode)
IF lnAtPos>0
	lcCode=LEFT(lcCode,lnAtPos-1)
ENDIF
RETURN lcCode
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform