The information in this article applies to:
- Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, and 2.5a
- Microsoft FoxPro for Windows, version 2.5 and 2.5a
SUMMARY
It is sometimes desirable to allow the user to specify a title for a screen
using variables or other hard-coded values. You can do this by using
generator directives in the screen setup code, as described below.
MORE INFORMATION
FoxPro for Windows
- Create or modify an existing screen.
- From the Screen menu, choose Layout. In the Title box, type the
variable for the title that will be passed into the screen. The
syntax for the title is:
~ title1
NOTE: A tilde (~) MUST be entered before the variable for the
title.
- Choose the Code button. In the Screen Setup Code box, type the
following code:
#ITSEXPRESSION ~
#SECTION1
PARAMETER title1
VARNAME=title1
- Generate the screen with the name SCREEN1.SPR.
- Run the screen by entering the following code in a program or in
the Command window:
title1=' My special screen title '
DO Screen1.spr WITH title1
The screen will be displayed with whatever character expression is
assigned to title1.
If you have a memory variable (numeric) with a value of 1027, and you try
either of these methods, you will get the literal string of the tilde and
the memvar, not the substitution. To display the title properly, do the
following:
- In the Command window, type the following:
USE tutorial\salesman
CREATE SCREEN.
- From the Screen menu, choose Quick Screen.
- From the Screen menu, choose Layout. In the Name box, type "mytest"
(without the quotation marks).
- In the Screen Layout dialog box, choose the Code button, and type the
following in the Setup Code box:
mydate=1027
modify window mytest title 'Title is '+alltrim(str(mydate))
FoxPro for MS-DOS
- Create or modify an existing screen.
- From the Screen menu, choose Screen Layout, and select Window. In
the Title box, enter the variable for the title that will be passed
into the screen. The syntax for the title is:
~ title1
NOTE: A tilde (~) MUST be entered before the variable for the
title.
- Under Screen Code, select Setup, and then choose OK. In the Setup
window, type the following code:
#ITSEXPRESSION ~
#SECTION1
PARAMETER title1
VARNAME=title1
- Generate the screen with the name SCREEN1.SPR.
- Run the screen by entering the following code in a program or in
the Command window:
title1=' My special screen title '
DO Screen1.spr WITH title1
The screen will be displayed with whatever character expression is
assigned to title1.
REFERENCES
"Developer's Guide," (MS-DOS), versions 2.0 and 2.5, pages D2-31 to
D2-32
"Developer's Guide," (Windows), version 2.5, pages D2-38 to D2-40
|