Microsoft KB Archive/132179

= PRB: Controls in a Page Frame Are Not Refreshed =

Article ID: 132179

Article Last Modified on 8/25/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a

-



This article was previously published under Q132179



SYMPTOMS
In a page frame, you observe that only the controls placed on the active page are refreshed when data changes. Controls in underlying pages are not refreshed until they receive the focus.



CAUSE
For performance reasons, only the active page in a page frame is refreshed when a form is refreshed. This is by design.



WORKAROUND
Alternatives include explicitly calling the Refresh method for each page that is to be refreshed. For example, it is possible to define a method that loops through the pages in a page frame and refreshes all the pages. The following code sample illustrates this method.

Code Sample
* Call this method ,and pass the name of the page frame as a PROCEDURE RefreshAllPages PARAMETER tcPageFrameName oRef=EVAL('thisform.'+tcPageFrameName) FOR I=1 TO oRef.PageCount oRef.Pages(I).Refresh ENDFOR Thisform.Refresh
 * parameter.
 * For example,
 * Thisform.RefreshAllPages('PageFrame1')

Alternative Workaround
Another alternative is to refresh a page when it becomes active. To accomplish this, place the following code in the method associated with the activate event of the page: This.Refresh



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Create a Form. Place a page frame on the Form. Using the secondary (right) mouse button, click the form. Then select Data Environment. Add the Employee table, located in the Samples\Data directory, to the Data Environment. Click Page1 on the Object menu in the Property sheet.  Select the text box control from the Form Controls toolbar, and place the text box on Page1. Modify the ControlSource property to be: Employee.Emp_id </li>  Place another text box on Page1, and modify the ControlSource property to be: Employee.Last_name NOTE: This step is important as the controls that do not have the focus when the page is activated are not refreshed. </li> Select Page2, and place two text boxes on that page. Change the ControlSource property of the controls to Employee.Address and Employee.City, respectively.</li>  Place a command button on the form, and place the following code in its Click event method: SKIP ThisForm.Refresh </li> Save and run the form. Click the command button to skip through the table, and activate each page. The data on the second text box is not refreshed.</li></ol>

Additional query words: VFoxWin

Keywords: KB132179

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.