Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 9.0 Fix - Large procedure in the form
Message
From
08/04/2012 04:30:55
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
VFP 9.0 Fix - Large procedure in the form
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01540614
Message ID:
01540614
Views:
157
Likes (1)
Hello everyone:

In vfp9, the procedure size can greater than 64KB.
But if there is a large procedure in the form, sometimes the form can't run correctly.

There is a program for test:
     *PROC testlargeform

     SET STEP OFF
     SET ECHO OFF
     SET DEBUG OFF
     SET ESCAPE OFF
     SET TALK OFF
     SET SAFETY OFF

     _SCREEN.VISIBLE=.T.
     _SCREEN.WINDOWSTATE=2

     PRIVATE m.x2
     m.x2=""

     COMPILE FORM testlargeform.scx
     =MESSAGEBOX("Now the form file testlargeform.scx is good."+CHR(13)+;
        "We will run DO FORM testlargeform.scx and there is no problem.",0,"TEST LARGEFORM")
     DO FORM testlargeform.scx

     =MESSAGEBOX("Please make some changes."+CHR(13)+;
        "For example, Comment or Uncomment some statements.",0,"TEST LARGEFORM")
     MODIFY FORM testlargeform.scx method INIT

     COPY FILE testlargeform.scx TO testlargeform_bad.scx
     COPY FILE testlargeform.sct TO testlargeform_bad.sct
     USE testlargeform_bad.scx
     LOCATE FOR objname="Form1"
     =STRTOFILE(objcode,"testlargeform_bad.fxp")
     USE

     COPY FILE testlargeform.scx TO testlargeform_good.scx
     COPY FILE testlargeform.sct TO testlargeform_good.sct
     COMPILE FORM testlargeform_good.scx
     USE testlargeform_good.scx
     LOCATE FOR objname="Form1"
     =STRTOFILE(objcode,"testlargeform_good.fxp")
     USE

     USE testlargeform.scx
     LOCATE FOR objname="Form1"
     PRIVATE m.q_com
     m.q_com=methods
     PRIVATE m.q_procedures
     m.q_procedures=""
     DO WHILE AT("PROCEDURE ",m.q_com)>0
        m.q_com=SUBS(m.q_com,AT("PROCEDURE ",m.q_com))
        m.q_procedures=m.q_procedures+LEFT(m.q_com,AT(CHR(13),m.q_com))
        m.q_com=SUBS(m.q_com,AT(CHR(13),m.q_com)+1)
     ENDDO
     USE
     m.q_procedures=STRTRAN(m.q_procedures,"PROCEDURE Init","PROCEDURE Init (LARGE PROCEDURE)")

     IF FILETOSTR("testlargeform_bad.fxp")==FILETOSTR("testlargeform_good.fxp")
        =MESSAGEBOX("It seems the form file testlargeform.scx is good."+CHR(13)+;
           m.q_procedures+;
           "We will run DO FORM testlargeform.scx and there is no problem.",0,"TEST LARGEFORM")
        DO FORM testlargeform.scx
     ELSE
        =MESSAGEBOX("Now the form file testlargeform.scx is bad."+CHR(13)+;
           m.q_procedures+;
           "If we run DO FORM testlargeform.scx then VFP will crash.",16,"TEST LARGEFORM")
        DO FORM testlargeform.scx
     ENDIF

     RETURN

     * END OF PROC TESTLARGEFORM.

     In the testlargeform.scx:

     PROCEDURE Load
     SET TALK OFF
     ?"Load"
     ENDPROC

     PROCEDURE Init
     * Please make some changes.
     * For example, Comment or Uncomment some statements.
     SET TALK OFF
     SET TALK OFF
     SET TALK OFF
     ?"Init"
     PRIVATE m.x2
     m.x2="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     m.x2="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     ...
     m.x2="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     m.x2="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
     ENDPROC

     PROCEDURE Destroy
     SET TALK OFF
     ?"Destroy"
     ENDPROC
The size of the procedure Init is about 100KB, it is a large procedure.

More details please refer to:

VFP 9.0 FIX - LARGE PROCEDURE IN THE FORM
http://www.baiyujia.com/vfpdocuments/default.asp

source code download:
http://www.baiyujia.com/f_download.asp
Welcome to VFP C++ Compiler: http://www.baiyujia.com/vfpcompiler
Next
Reply
Map
View

Click here to load this message in the networking platform