Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom form builder causes C0000005
Message
From
23/05/2006 17:55:42
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Custom form builder causes C0000005
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01124403
Message ID:
01124403
Views:
66
Hi All,

I'm working on a program to process a bunch of forms to set some properties and to reset a method to default.

Below is the code for a custom form-builder prg I am working on. It is not registered, I am just calling it from the command window.

It recurses through the controls on the form currently open in the designer. After finding each occurence of my class [srchfield], it sets two properties by parsing the controlsource and then sets the [gotfocus] method to default. It also reads the method into a variable, beforehand, because I planned to do more with it.

If I don't comment the line containing the ResetToDefault call in procedure ProcessSrchField, I die with a C0000005 error when I re-select the form designer, and have to close fox. Everything else seems to work great.
* form builder test
CLEAR
DELETE FILE c:\crap\mylog.txt
Public ltest[1]
Aselobj(ltest,1)

oMyFrm = ltest[1]

For Each oCtrl In oMyFrm.Controls
	If Alltrim(Lower(oCtrl.Class)) == [pageframe]
		Do ProcessPageFrame With oCtrl
	Endif
	If Alltrim(Lower(oCtrl.Class)) == [srchfield]
		Do ProcessSrchField With oCtrl
	Endif
Next oCtrl

CLOSE TABLES all
CLOSE DATABASES all
CLEAR ALL
RELEASE ALL
SET CLASSLIB TO



Procedure ProcessPageFrame
	Lparameters oPageFrame
	Local oPage
	For Each oPage In oPageFrame.Pages
		STRTOFILE(oPage.Name+CHR(13)+CHR(10),[c:\crap\mylog.txt],1)
		DO Processpage WITH oPage
	Next oCtrl

Endproc


PROCEDURE ProcessPage 
Lparameters oPage
LOCAL oCtrl

For Each oCtrl In oPage.Controls
	If Alltrim(Lower(oCtrl.Class)) == [pageframe]
		Do ProcessPageFrame With oCtrl
	Endif
	If Alltrim(Lower(oCtrl.Class)) == [srchfield]
		Do ProcessSrchField With oCtrl
	Endif
Next oCtrl


ENDPROC 


PROCEDURE ProcessSrchField 
LPARAMETERS oCtrl

STRTOFILE(oCtrl.Class + [:] + oCtrl.Name+CHR(13)+CHR(10),[c:\crap\mylog.txt],1)
LOCAL cSrc, cAlias, cTag 
cSrc = oCtrl.controlsource

cAlias = GETWORDNUM(cSrc,1,[.])
cTag = GETWORDNUM(cSrc,2,[.])

oCtrl.icsrchAlias = cAlias
oCtrl.icsrchTag = cTag
cSrc = oCtrl.readmethod([GotFocus])
*oCtrl.resettodefault([GotFocus])
ENDPROC 
Jim Newsom
IT Director, ICG Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform