Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to convert class to form
Message
 
To
22/08/2006 20:34:13
Max Chen
Yx Software
Shunde, China
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01147612
Message ID:
01147842
Views:
19
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'
Previous
Reply
Map
View

Click here to load this message in the networking platform