?
Solved

Programming code with runtime form

Posted on 2014-01-22
4
Medium Priority
?
696 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 43

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 43

Accepted Solution

by:
pcelba earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Moore’s Law has proven itself time and time again since it was first introduced. So what’s next? Will Moore’s law continue to remain relevant, or will new technology take over and bring us the next big advancement in computing?
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 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