Solved

Programming code with runtime form

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic rowheight in Foxpro grid 8 312
Amyuni PDF Suite Windows 7 x64 11 1,076
Can a CDX FoxPro file be opened by another application 10 190
VFP9 in Windows 10 9 266
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…
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now