Microsoft KB Archive/105280

{| = How to Create a Screen with a User-Defined Title =
 * width="100%"|

ID: Q105280

2.00 2.50 2.50a | 2.50 2.50a

MS-DOS         | WINDOWS kbui 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.

FoxPro for Windows
1. Create or modify an existing screen.

2. 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. 3. Choose the Code button. In the Screen Setup Code box, type the following code:

#ITSEXPRESSION ~ #SECTION1 PARAMETER title1 VARNAME=title1 4. Generate the screen with the name SCREEN1.SPR. 5. 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:

1. In the Command window, type the following:

USE tutorial\salesman CREATE SCREEN. 2. From the Screen menu, choose Quick Screen. 3. From the Screen menu, choose Layout. In the Name box, type "mytest"

(without the quotation marks). 4. 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 1. Create or modify an existing screen.

2. 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. 3. Under Screen Code, select Setup, and then choose OK. In the Setup window, type the following code:

#ITSEXPRESSION ~ #SECTION1 PARAMETER title1 VARNAME=title1 4. Generate the screen with the name SCREEN1.SPR. 5. 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.