FIX: Problems with @GETS and CLEAR GETS If No READ

ID: Q183895

The information in this article applies to:

SYMPTOMS

An @...GET text box control does not remain visible.

CAUSE

This is known to happen in Visual FoxPro 5.x when the @...GET is cleared with the CLEAR GETS command before it has been activated with a READ command.

RESOLUTION

One possible resolution is to issue a READ TIMEOUT .001 after the @...GET prior to the CLEAR GETS command. Please see the sample program in the Steps to Reproduce Behavior section below for an example.

A better solution would be to use Object-Oriented Programming (OOP) style programming with a Text box control. Implementing this workaround would depend on the situation.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0.

MORE INFORMATION

Prior to Visual FoxPro, @...GET controls activated by a READ were the primary method that a programmer used in a user interface for users to enter information into a table (in addition to a BROWSE window) or a memory variable. The @...GET controls included text boxes, edit boxes, combo boxes, list boxes, and other controls. The @...GET controls need to be activated by a READ command before they can be used to enter data.

The CLEAR GETS command releases all pending @...GET controls.

Steps to Reproduce Behavior

The program code below can be used to reproduce the problem.

1. Enter the following program code into a new program file and save it

   with the name GetProb.prg:

      CLEAR
      x="This is a test"
      y="Test 2"
      @ 5,5 GET x
      *    READ TIMEOUT .001     && Uncomment this for a workaround.
      CLEAR GETS
      @ 7,10 GET y
      READ

2. Run the program with the following command in the Command window:

      DO GetProb.prg

3. When you notice that only one of the @...GETs stays visible on the
   Visual FoxPro desktop, press TAB or ENTER to clear the READ and return
   to the Command window.

4. Uncomment the READ TIMEOUT .001 command and rerun the program. Note that
   the first @...GET displaying "This is a test" remains visible.

Additional query words: kbvfp600fix
Keywords          : FxprgGeneral FxprgRead 
Version           : WINDOWS:5.0,5.0a
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbpending

Last Reviewed: October 29, 1998