Solved

Programming code with runtime form

Posted on 2014-01-22
4
632 Views
Last Modified: 2014-01-22
Hi, looking a way to program "external executable" subroutine (PRG) within a runtime form.  Basically, my application is self-contained and I recently added "customs" programming to satisfy some customer specific requirements without having to modify core application.  So, I'm looking to create a form with some selection tools to allow authorized user to see and modify external PRG code.  User can copy code from one PRG, add it to another PRG and then save this "new work".  
Is this something that can be done under VFP 9
0
Comment
Question by:meep_meep
  • 2
  • 2
4 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 39800095
This is very easy:
1) To modify PRG code issue MODIFY COMMAND <filename>
2) To compile the modified code issue COMPILE <filename>

Above commands work even under VFP 9 run-time so you may place then almost anywhere.

If the Edit menu is visible the CTRL+C and CTRL+V etc. shortcuts are active.

MODIFY COMMAND has several useful clauses like NOEDIT which allows just viewing of the source code so this can be used to copy the existing fragments of code.

COMPILE produces <filename>.ERR if compile error occurs.

WARNING: Remember the fact users can harm app data this way...
0
 

Author Comment

by:meep_meep
ID: 39800160
So, I can issue a Modify Command within a runtime Form ?   To be more specific, my form will have a list of customer specific external prg.   On InteractiveChange event, I will be able to show within an "Edit box like" the specified PRG in my form ?
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 39800184
Yes. The Edit box should be bound (via ControlSource property) to some memo field and the interactive event may read the memo contents by APPEND MEMO FROM <YourFile>.PRG command then user may edit the code and save it back to PRG or keep it in the memo field.

EXECSCRIPT command allows to execute the code inside the memo.

Of course you don't need to use memo field but the whole thing may be in some variable or in a form property.  You may read the PRG file into the variable by FILETOSTR() function call in InteractiveChange event. Reading the local file this way is very fast.
0
 

Author Closing Comment

by:meep_meep
ID: 39800762
As usual, you're quick and efficient. Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Troubleshooting common task sequence error codes
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question