Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form looks funky after changing HelpContextIDs?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00549166
Message ID:
00549175
Views:
26
This is a method that finds the form field and associated HelpContextID and updates it based upon our home-grown data dictionary. I find the field name by looking at the ControlSource in the properties memo field in the form .SCX file. I also find the HelpContextID by looking at the properties memo field in the form .SCX file. Then I find the matching data dictionary entry that goes with the form and merge the data dictionary with the form .SCX file, but only the HelpContextID value gets affected... or that is the plan anyway. Thanks again.
LOCAL lcProperties nAnswer
nAnswer = 0
lcProperties = ""
CtrlSrc = ""
HelpCntxtID = ""

* Find form field name in ControlSource
STORE "ControlSource =" TO gcString2
ALINES(myarray,properties)
SET EXACT OFF
IF ASCAN(myarray,gcString2) > 0
	gnPos = ASCAN(myarray,gcString2)
	CtrlSrc = myarray(gnPos)
	IF SUBSTR(CtrlSrc,17,3) = '"m.'
		STORE '"' TO gcFindString
		FirstQuotMark = AT(gcFindstring,CtrlSrc)
		CtrlSrce = SUBSTR(CtrlSrc,FirstQuotMark+3,LEN(CtrlSrc)-20)
	ENDIF
ENDIF

* Find matching field name in Data Dictionary
SET EXACT OFF
seekid = ALLT(app_frms.db)+UPPER(ALLT(CtrlSrce))
USE c:\datadict\datadict IN 0 SHARED
SELECT datadict
SET ORDER TO db_field
SEEK seekid
IF FOUND()
	* Find HelpContextID and replace its value
	STORE "HelpContextID =" TO gcString3
	SELECT form_file
	ALINES(myarray,properties)
	SET EXACT OFF
	IF ASCAN(myarray,gcString3) > 0
		gnPos = ASCAN(myarray,gcString3)
		HlpCntxtID = myarray(gnPos)
		HelpCntxtID = SUBSTR(HlpCntxtID,17,Len(HlpCntxtID)-16)
		myarray(gnPos) = "HelpContextID = " + ALLT(STR(datadict.help_num))
	ENDIF
	FOR i = 1 TO ALEN(myarray,1)
		lcProperties = lcProperties + myarray(i)+CHR(13)
	ENDFOR
	IF INT(VAL(HelpCntxtID)) <> datadict.help_num
		IF nAnswer2 = 6
			REPLACE form_file.properties WITH lcProperties
		ELSE
			nAnswer = MESSAGEBOX("Form field HelpContextID=" + ALLT(HelpCntxtID) + ;
				" does not match Data Dictionary Help Number " + ALLT(STR(datadict.help_num)) + ;
				". Do you want to replace it?",4+32+256,"Data Dictionary to Form")
			IF nAnswer = 6
				REPLACE form_file.properties WITH lcProperties
			ENDIF
			IF nAnswer2 = 0
				nAnswer2 = MESSAGEBOX("Do you want to replace all HelpContextIDs from Data Dictionary?",4+32+256,"Data Dictionary to Form")
			ENDIF
		ENDIF
	ENDIF
ELSE
	MESSAGEBOX("Field " + UPPER(ALLT(CtrlSrce)) + " not found in Data Dictionary. " + ;
		"You may add the field later using the Form to Data Dictionary form.",64,"Data Dictionary to Form")
ENDIF

SELECT datadict
USE
SELECT form_file
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform