BUG: ListBox Does Not Refresh Properly with SET FILTER Command

Last reviewed: May 5, 1997
Article ID: Q135754
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a

SYMPTOMS

A listbox displaying fields from a table is not refreshed correctly when the following commands are issued:

   SET FILTER TO <myfilter>

Then one of the following two commands:

   ThisForm.Refresh
   ThisForm.List<#>.Refresh

WORKAROUND

Immediately after issuing the SET FILTER command, issue a SETFOCUS command to the list box and back again to the object on the form where control should be. As in the "Steps to Reproduce Behavior" below, in the Click event of the command buttons, the following lines of code would be used:

  ThisForm.List1.SetFocus       && sets the focus to the list box
  ThisForm.Command<#>.SetFocus  && sets the focus back to the button

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Problem

  1. Create a new form.

  2. Add the Customer table to the data environment.

  3. Create a list box on the form.

    a. Set the RowSource property to "customer.country" b. Set the RowSourceType to "6 - Fields"

  4. Create a Command1 button, and enter the following code in its Click event procedure:

    SET FILTER TO maxordamt > 25000.0000 && sets the filter

       x=FILTER()                && populating the variable with the filter
       thisform.refresh          && refreshing the form
    
    

  5. Create a Command2 button, and enter the following code in its Click event procedure:

    SET FILTER TO maxordamt = 5000.0000 && sets the filter

       x=FILTER()               && populating the variable with the filter
       thisform.refresh         && refreshing the form
    
    

  6. Create a Command3 button, and enter the following code in its Click event procedure:

    SET FILTER TO country = "Germany" && sets the filter

       x=FILTER()               && populating the variable with the filter
       thisform.refresh         && refreshing the form
    
    

  7. Create a Command4 button, and enter the following code in its Click event procedure:

       SET FILTER TO            && clears the filter
       x=FILTER()               && populating the variable with the filter
       thisform.refresh         && refreshing the form
    
    

  8. Create a text box, and set its ControlSource property to x.

  9. Run the form, and click the Command1 button. Notice that the list box doesn't refresh properly. Click the other buttons, and watch the behavior of the list box. Click the list box, and watch the contents change according to which filter is set. Watch the text box to see which filter is set.


Keywords : buglist3.00 buglist3.00b buglist5.00 kbtool vfpbug5.0a kbbuglist
Version : 3.0 3.0b 5.0 5.0a
Platform : WINDOWS
Issue type : kbbug


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.