The information in this article applies to:
- Microsoft FoxPro for Windows, versions 2.5x, 2.6
- Microsoft FoxPro for MS-DOS, versions 2.5x, 2.6
SUMMARY
NOTE: Microsoft does not provide technical support for FoxPro tools such as
GENSCRN.PRG after they have been modified from their original form.
In some cases, the text labels and refreshable SAY fields in the Screen
Builder may need to be redisplayed, such as on a screen that was previously
CLEARed. Text objects created in the Screen Builder are generated as SAY
objects in the .SPR code. In order to refresh these field label SAYs as
well as the output SAY fields, the @ ... SAY commands must be placed in the
SHOW clause of the generated code. The example below shows how to modify
GENSCRN to accept a custom generator directive which will force all text
labels along with refreshed SAY field objects to be redisplayed.
NOTE: At least one SAY field must have the Refresh check box option marked
in the Output Field dialog box of the Screen Builder so that its contents
will reappear, as well as to trigger generation of the SHOW clause code.
MORE INFORMATION
- Copy the current GENSCRN.PRG file to another file. For example, type
the following command at the MS-DOS command prompt in the main FoxPro
directory:
COPY GENSCRN.PRG SCRENGEN.PRG
- The newly created file should replace GENSCRN so that future updates
will not overwrite changes, as well as to preserve a copy of the
original file. In order for FoxPro to always use SCRENGEN instead of
the original GENSCRN program, the _GENSCRN system variable must be
changed to point to the custom program. If the CONFIG.FPW or CONFIG.FP
file does not already exist, create it as an ASCII text file and type
the following command in the file:
_GENSCRN="C:\<FoxPro_directory>\SCRENGEN.FXP"
- Start FoxPro, and then issue the following command in the Command
window:
MODIFY COMMAND SCRENGEN
- In the editing window, press CTRL+F, type the following text to look
for, and then choose the Find button or press CTRL+W:
m.g_noreadp
- Add a new line below the "m.g_noreadplain = .F." line, and enter the
following statement:
m.g_saytext = .F. && custom flag to refresh text SAYs
NOTE: Although it is not critical to align the text with the
statements above it, readability will be maintained in doing so.
- Press CTRL+F, and find the following text:
#READ"
NOTE: Be sure to use a double quotation mark, not two single quotation
marks.
- When you find the text, press the HOME key, copy the line (including
the carriage return) by pressing SHIFT+END, SHIFT+RIGHT ARROW, and
then CTRL+C. Press the DOWN ARROW key 17 times, and place the cursor
in the home position on the line containing "ENDCASE".
- Press CTRL+V to paste in the new line, and change "READ" to "SAYT" and
"READCLAUSES - Additional READ clauses" to "SAYTEXT - Custom
directive".
- Insert a new line below the pasted line, and type:
REPLACE ALL showtype WITH 1, refresh WITH .T. FOR objtype = 5
- Insert another line, and type:
m.g_saytext=.T.
The additions in context should now appear as follows:
.
.
.
ENDIF
CASE LEFT(m.upline,5)="#SAYT" && #SAYTEXT - Custom directive
REPLACE ALL showtype WITH 1, refresh WITH .T. FOR objtype = 5
m.g_saytext = .T.
ENDCASE
.
.
.
- Press CTRL+F, and find the following text:
REFRESH =
NOTE: Make sure you include the space before the equal sign.
- Press the HOME, UP ARROW, UP ARROW, CTRL+RIGHT ARROW, and CTRL+RIGHT
ARROW keys to move the cursor to the first parenthesis in the "SCAN FOR
((objtype = c_otfield ..." line, and then insert an additional left
parenthesis, so that the first part of the line now reads:
SCAN FOR (((objtype = c_otfield ...
- Press CTRL+G and then press END to move to the end of the line, and add
another right parenthesis, a space, and a semicolon, so that the line
now reads:
... g_screens[m.g_thisscreen,7])) ;
- Add a new line below this line, and enter the following:
OR (objtype = 5 AND m.g_saytext)
- Press CTRL+W to close and save the program. Compile the new program by
choosing Compile from the Program menu, or by typing the following
command in the Command window:
COMPILE SCRENGEN.PRG
Now that the SCRENGEN.PRG program is in place, you can specify the option
to refresh text field label SAYs by placing the custom generator directive
#SAYTEXT in the Setup code of the appropriate screen. If the #SAYTEXT
directive is not used, the screen will be generated normally.
Functionality
The memory variable m.g_saytext is used to determine whether to generate
code to refresh all the SAYs found in the .SCX file. In order for SAYs to
be refreshed, the same code used in the screen layout section of the
generated code is repeated in the SHOW clause of the READ command.
Normally, only SAY screen fields (objcode 15) that have the Refresh check
box selected are generated in the SHOW clause during the PLACESAYS
procedure within the screen generator. By adding the OR clause to include
SAY objects (objcode 5) when m.g_saytext is .T., normal SAYs will also be
placed in the SHOW routine.
However, to meet the other requirements imposed by the generator code, two
values must be changed in the .SCX file so that the SAY objects will be
included. The Showtype and Refresh fields are changed within the
NOTEDIRECTIVES procedure whenever it detects that the #SAYTEXT directive is
found in the Setup code of the current screen. (Changing the .SCX database
for the SAYs will not affect their appearance within the Screen Builder
during modification.) Additionally, the m.g_saytext memory variable is set
to TRUE.
To further refine the scope of which normal SAY objects are included, this
section of the generator program could be modified to accept parameters
after the #SAYTEXT directive. For example, "#SAYTEXT 2,5,6-12" could
indicate to refresh only objects 2 and 5 along with the range of objects 6
through 12. This would be determined by only replacing the Showtype and
Refresh fields for these particular records, indicated by a further
condition of the REPLACE ... FOR clause. The actual code to perform this
restriction would vary, depending upon the chosen implementation of
parameter representations.
|