Solved

Programming code with runtime form

Posted on 2014-01-22
4
646 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 42

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 42

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

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…
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

829 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