Microsoft KB Archive/119692

{| = Keeping Forms/Screens from Flashing in Multi-Form/Screen Set =
 * width="100%"|

ID: Q119692

2.5x 2.6x 3.00 | 2.00 2.5x 2.6x

WINDOWS       | MS-DOS kbtool kbprg The information in this article applies to:


 * Microsoft Visual FoxPro for Windows, version 3.0
 * Microsoft FoxPro for Windows, versions 2.5x, 2.6x
 * Microsoft FoxPro for MS-DOS, versions 2.0, 2.5x, 2.6x

SUMMARY
When you are running a program with multiple screens that has been built with the Form Designer or Screen Builder, it is not desirable to have the forms or screens flash when the program starts up.

In Visual FoxPro, use the .Visible property to prevent this from happening.

In FoxPro 2.x, by using the MOVE WINDOW command to move the screens after they are defined, you can keep them from flashing on the screen when they start up. After the screen set is started and the first screen is in place, the other screens can then be moved to their positions within the screen set. Below is the code needed to keep the second and third screens from flashing when they are started with the first screen of a three-screen set.

Visual FoxPro
1. Create a FormSet containing three forms, using their default names of

Form1, Form2, and Form3. Change the Visible property to .F. for Form2 and Form3. 2. Add two buttons named btnScr2, btnScr3 to Form1. 3. Add the following code to the btnScr2 Click method:

IF ThisFormSet.Form2.visible=.F.       ThisFormSet.Form2.visible=.T.      ENDIF 4. Next, add another line at the bottom of the code for the btnScr2 Click method to set the focus to a specific object on that form. For example, if there is a TextBox called Text1 on the form, the last line of code in  the Click method should be:

ThisFormSet.Form2.Text1.SetFocus

5. Repeat steps 3 and 4 for the btnScr3 Click method, changing the references from Form2 to Form3. NOTE: Similar buttons using the Setfocus method could be used on Form2 and Form3 to switch between screens. NOTE: As an alternative, a pageframe could be used to accomplish this too.

FoxPro 2.x
1. Create a screen called SCR_ONE.

2. From the Screen menu, choose Layout (choose Screen Layout in FoxPro   for MS-DOS). In the Name box, type "firstscr" (without the quotation   marks). If you are using FoxPro for Windows, choose the Code button and then choose Screen Setup Code. If you are using FoxPro for MS-DOS, select the Setup check box. In this box, type:

MOVE WINDOW secondscr TO 0,200  && This will move the && screens off the MOVE WINDOW thirdscr TO 0,200   && current desktop area. moveflag = .T.

3. Create a push button with the prompts "SCREEN2" and "SCREEN3" (without   the quotation marks). Give it the variable name "m.scr1" (without the   quotation marks). In the VALID clause of the push button, type this code:

IF moveflag = .T.         MOVE WINDOW secondscr to 0,0   && This will move the MOVE WINDOW thirdscr to 0,0   && screens to the upper- moveflag = .F.                && left corner. ENDIF

DO CASE CASE m.scr1 = 1 _CUROBJ=OBJNUM(m.scr2) CASE m.scr1 = 2 _CUROBJ=OBJNUM(m.scr3) ENDCASE

4. Create a screen called SCR_TWO.

5. From the Screen menu, choose Layout (choose Screen Layout in FoxPro   for MS-DOS). In the Name box, type "secondscr" (without the quotation   marks).

6. Create a push button with the prompts "SCREEN1" and "SCREEN3" (without   the quotation marks). Give it the variable name "m.scr2" (without the   quotation marks). In the VALID clause of the push button, type this code:

DO CASE CASE m.scr2 = 1 _CUROBJ=OBJNUM(m.scr1) CASE m.scr2 = 2 _CUROBJ=OBJNUM(m.scr3) ENDCASE

7. Create a screen called SCR_THRE.

8. From the Screen menu, choose Layout (choose Screen Layout in FoxPro   for MS-DOS). In the Name box, type "thirdscr" (without the quotation   marks).

9. Create a push button with the prompts "SCREEN1" and "SCREEN2" (without   the quotation marks). Give it the variable name "m.scr3" (without the   quotation marks). In the VALID clause of the push button, type this code:

DO CASE CASE m.scr3 = 1 _CUROBJ=OBJNUM(m.scr1) CASE m.scr3 = 2 _CUROBJ=OBJNUM(m.scr2) ENDCASE 10. Bring up screen SCR_ONE. From the PROGRAM menu, choose Generate. Add screens SCR_TWO and SCR_THRE to the screen set, and then generate the screen set. At the Command window, type "DO scr_one.spr" (without the    quotation marks). The screens will not flash because they have been moved. If one of the push buttons is pressed, screen 2 and screen 3 will move to the upper-left corner of the screen. The HIDE WINDOW command also can be used to hide the screens that are not on top until they are called. Additional reference words: FoxDos FoxWin VFoxWin 2.00 2.50 2.50a 2.50b 2.60 3.00 Sbuilder KBCategory: kbtool kbprg KBSubcategory: FxtoolFormdes

Keywords         : FxtoolFormdes Version          : 2.5x 2.6x 3.00 | 2.00 2.5x 2.6x Platform         : MS-DOS WINDOWS
 * }