Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert class to form
Message
 
À
22/08/2006 20:34:13
Max Chen
Yx Software
Shunde, Chine
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01147612
Message ID:
01147842
Vues:
25
Great, I will check it out.

>HELLO
>
>Think u for all your opinion and kindness. :)
>
>I have make certain classes for my app.
>
>But i consider that they should be form/scx rather
>
>then class in a classlib. It's better to modifing
>
>,caz the feedback is speeded up.
>
>So i gonna convert them back to form in a easy way.
>
>
>I had wrote a form to accomplish the job last night.
>
>Here are some code segment. I will send it to download zone
>
>after some debugging.
>
>
>cmdDoConvert.click
>
>
>IF EMPTY(this.Parent.cboForm.Value) OR  !USED('vcx')
>	RETURN .f.
>ENDIF
>
>LOCAL nBegPos,nEndPos,lErr,cPathAndStem
>
>cPathAndStem= JUSTPATH(this.Parent.txtscx.Value) + JUSTSTEM(this.Parent.txtscx.Value)
>
>SELECT vcx
>LOCATE FOR TRIM(baseclass)=='form' AND TRIM(objname)==this.Parent.cboForm.Value
>IF NOT FOUND()
>	MESSAGEBOX('error while locate the class',48,'')
>	RETURN .f.
>ENDIF
>
>SKIP -1
>nBegPos=RECNO()
>SKIP
>
>LOCATE FOR TRIM(platform)=='COMMENT' REST
>IF NOT FOUND()
>	MESSAGEBOX('error while search the end postion of class',48,'')
>	RETURN .f.
>ENDIF
>
>nEndPos=RECNO()
>*----------------------
>
>TRY
>	SELECT *;
>		FROM vcx;
>		WHERE RECNO()>=nBegPos AND RECNO()<=nEndPos;
>		INTO TABLE (cPathAndStem)
>CATCH
>	lErr=.t.
>ENDTRY
>IF lErr
>	MESSAGEBOX('error while saving form ',48,'')
>	RETURN .f.
>ENDIF
>*-----------------------------
>USE IN vcx
>
>CURSORSETPROP("Buffering" ,1)
>REPLACE uniqueid WITH 'Screen',;
>		reserved1 WITH 'VERSION =   3.00'
>USE
>
>cPathAndStem= JUSTPATH(this.Parent.txtscx.Value) + JUSTSTEM(this.Parent.txtscx.Value)
>
>TRY
>	ERASE (cPathAndStem+'.scx')
>	ERASE (cPathAndStem+'.sct')
>CATCH
>	lErr=.t.
>ENDTRY
>IF lErr
>	MESSAGEBOX('error while overwriting existed form ',48,'')
>	RETURN .f.
>ENDIF
>		
>RENAME (cPathAndStem+'.dbf') TO (cPathAndStem+'.scx')
>RENAME (cPathAndStem+'.fpt') TO (cPathAndStem+'.sct')
>
>IF MESSAGEBOX('convert finished. do u want to open it?',4+32 ,'')=7 &&NO
>	RETURN .T.
>ENDIF
>*---
>
>MODIFY FORM (cPathAndStem) NOWAIT
>
>
'If the people lead, the leaders will follow'
'War does not determine who is RIGHT, just who is LEFT'
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform