Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fox 2.6 screens (Educational Question) 4

Status
Not open for further replies.

jlg13

Technical User
May 10, 2001
61
US
Hi Fox Experts,

I have a small Fox 2.6 application that consists of a single program and several screens that my father had coded for me. I am a little confused around working with screens...

Things I think I know

1. I can edit an SPR file in notepad... changes are compiled as SPX

2. From the command prompt, I can use Fox modi screen to add a field to the screen display. I am not sure if I am editing the SCT or SCX file. After I add a field (for example) I don't understand the difference between "Program->Compile" vs "Program->Generate" I think, I did it both ways and one of the ways wiped out my SPR changes

Do the 4 screen files work together or are they 2 separate pieces... one to create a program that works in conjunction with the screen itself?

If anyone has a beginner programmer explanation, I would appreciate the education.

Thx,
Joe

 
You should never edit an SPR. The Screen Designer modifies the SCX and SCT files, which are just a DBF with a special extension.

Use Program -> Generate to turn the SCX/SCT into an SPR, which will be compiled into an SPX when you run it.

If you want to make changes, make them using the Screen Designer, not on the SPR.

Tamar
 
I never used FP 2, but my guess is this is similar to the way the visual menu editor still works in VFP.

We have (more or less) visual menu designer, which stores the menu definition including procedures called by menu items etc.

The definition menu data is stored in a table (so actually a dbf and fpt file pair) with extensions mnx and mnt. Menu->Generate creates an MPR, which is a PRG and that finally actually runs.

And screend seem to work similar, so yes, everything you assume would fit into that same scheme. When you edit an MPR and then edit the menu in the designer your MPR changes are lost, as this is a one way ticket. When you decide to change the MPR code, these changes don't relflect in the mnx/mnt table file with the menu meta data.

And there sometimes are or would be good reasons to do more than you can do with the designer in the MPR code directly. I assume the same is true for the SPR code generated and then extended by yourself.

I have no idea if the similarities go as far, but you can decide to fork off the MPR by simply renaming it to a normal PRG. Then generate won't overwrite that. It still means you can't do both editing by desginer, in your case screen designer, and by code/program editor.

And definitely yes, notepad or any editor is fine for editing PRGs. VFP has an EOF byte, but that's optional. What you must avoid is a BOM marking a PRG or MPR or SPR file as UTF-8 or Unicode, the compiler would fail on these bytes added at the begin of a file by notepad, when you save as other types than ANSI.

Regarding menus the philosphy I now have is relying more on what the designers offer, inclluding the menu designer, you get into each remote corner of code that seems hidden, but you have to learn the details about the desinger, in the menu designer that includes how and where to define the menu bar code and setup and cleanup code.

I assume similar things exist for screens. The final result is just the SPR, the scx and sct files surely also are a dbf file pair, but differ from forms in VFP by having another structure (both other fields and records). You have more guided designing experience with a FP IDE, even if a small change is easier to do with direct editing of the SPR, but it's not changing the original IDE meta data about the screen in SCX/SCT.

And what's definitely not recommendable us to browse the SCX file and edit it as a table.

Bye, Olaf.

Olaf Doschke Software Engineering
 
I see, that overlapped. Tamar confirms what I suspected.

So just like you could take the MPR and continue work on that instead of using the menu designer you can modify the SPR, you just can't go back to using the screen designer as a modified SPR doesn't retranslate into the SCX/SCT the screen designer maintains.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thanks Guys.

Tamar, I have no idea how to accomplish what I did in the SPR in the screen designer. In the SPR (that I now know not to mess with), I do see my dad's custom code...

I added a new field pk_expire at the end of the IF and REPLACE lines.

Any idea where I would find this code in the screen designer so I can add it there?

SELECT LM_Stdnt
IF street # m.street OR city # m.city;
OR state # m.state OR zip # m.zip OR country # m.country;
OR cell # m.cell OR hold # m.hold OR upgraded # m.upgraded OR l_per_wk # m.l_per_wk;
OR birthdate # m.birthdate OR status # m.status OR pk_expire # m.pk_expire && 242 characters

REPLACE street WITH m.street, city WITH m.city, state WITH m.state, zip WITH m.zip, country WITH m.country,;
cell WITH m.cell, hold WITH m.hold, upgraded WITH m.upgraded, l_per_wk WITH m.l_per_wk, birthdate WITH m.birthdate,;
status WITH m.status, pk_expire with m.pk_expire && 246 characters

ENDIF
 
If I remember correctly, there are "Setup" and "Cleanup" areas of the screen where you can put any necessary setup code, or functions and procedures that you need. You will need to determine where the code snippet that you sent is located and if it belongs in "Setup" or "Cleanup", but I suspect it belongs in one or the other.
 
On top if that I can only draw conclusions from the menu designer which besdes setup and cleanup code allows you to add procedures and calls into menu bars and as reaction to picking a menu item.

I'm talking like the blind of the color, but I assume there is no simple search covering all of the screen like you can open a form in the form designer and simply search the current procedure you edit with what is usualy for whole Windows: STRG+F or context menu->Find or main menu Edit->Find (again hotkey CTRL+F. But such a search feature don't exist for the menu designer and I assume that's also missing for the screen designer.

As already hinted you can USE an SCX and then likely find it in a memo, the rest of the record may give you a hint where to look into in the screen designer mode of legacy VFP.

VFP9 introduced searching in all of a project, even including stored procs, once you add a DBC to your PFX. But actually VFP9s search tool code references finds code I wrote into a procedure stored in an MNX. Double clicking that get to the menu designer and the menu item that has this procedure code. Just the procedure code editor itself does not pop up.

I doubt that editing the project with the VFP9 IDE would give you that search capability within SCXes, as even just opening a legacy project will start a conversion process and screens are converted to either PRGs or forms but not both.

So look out for how the main menu changes when you go into screen editing mode. In VFP you typically have a specific new menu bar for the designer you're currently using, eg Class when editing a class, Form when editing a Form and Report when editing e Report. So my guess is the legacy IDE has the same extra Screen menu while you edit a screen and that's where you also likely will find the setup and cleanup somewhere. Or as in the menu designer duried in the View menu, View->General Options is here you find Setup and Cleanup of a menu.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thank you guys very much! I found where the custom code is located in the screen generator!

Since my dad passed, it's been a challenge to maintain and append code his code as a novice "programmer" I can't even call myself that... I am decent at "maintaining." You all have been very helpful. Very appreciated.

I'll be back...

Joe
 
FPD 2.6 has a Project Manager so you can open your screen in that or in the command window. Either way, when you open a screen, a "Screen" option will be added to the FP menu. Under that you will have options of "Screen Layout" and "Open All Snippets" (Snippets are generally the Whens and Valids of the objects on your screen, plus the Setup and Cleanup code). The easiest way to get to the Setup and Cleanup code only is by using the "Screen Layout" option where you will find a way to open these two.
Opening all snippets will (as it says...) open all snippets in cascading windows on your screen. This could be a LOT of windows :). Although you cannot use CTRL-F to search them as easily as now, you can go through one at a time fairly quickly this way.

Larry (TPG)
 
Thanks Larry. My dad did not set this up in a traditional development setting so a Project Manager environment doesn't exist. I have a working folder with tables and then a programs and screens sub folder (plus a few others) with the actually PRG/FXP files in the Programs folder and the 4 screen types in the screens folder. This is a small program for a newer company (3 years) that my dad whipped up. It has one main PRG and it is mostly driven by screens. This entire thread has helped me get a better grasp of the structure.

I have a much older company that is set up similar in terms of working folder and sub folders... but I am dealing with over 30 PRGS that primarily drive processing... I have my work cut-out for me on that one!!

Thank you again, I breathe easier just knowing you guys are out there.

Joe
 
If this works as in VFP you are able to establish a project, first empty, and then add the files in. That's usually also a better basis for any operations and am organizational level on top of just folders. Kist as ano overview what files you have and as starting point to edit them and build the final executable.

Especially also managing advanced things like encryption of the executable, executable icon.

Bye, Olaf.



Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top