Microsoft KB Archive/143296

= FIX: NODEFAULT in Page's Deactivate Event Activates Wrong Tab =

Article ID: 143296

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q143296



SYMPTOMS
Using NODEFAULT in the Page's Deactivate event stops the current page from changing, but the tab of the page will not be active. Whichever tab is clicked, the tab - 1 is the one that is brought forward. Therefore, if you are located on page one and click the fourth page, tab 3 will be moved to the front yet page one's objects continue to show on the pageframe.



WORKAROUND
Move the NODEFAULT condition to the Activate event of each page. Create one property in the form, and make it store the current page of the pageframe. The default value should be 1. In the Activate event for each page, evaluate the variables to see if the page should come forward. If it shouldn't come forward based on certain conditions, issue the NODEFAULT and set the ACTIVEPAGE to the form property. If the page should come forward, don't use the NODEFAULT clause, and reset the curPage property to the current page.

Following is an example of what might be used in the Activate event of the page. CurPage is a form property that stores the current active page in the pageframe. Lexpression is the condition that must be met before the page will activate. IF THISFORM.curPage != 1 AND THISFORM.curPage = 1 ELSE && Resets the active page NODEFAULT THIS.PARENT.ActivePage = THISFORM.curPage ENDIF The value of curPage in this code would change to the page's number of the current Activate event. For example, if this code was in the fourth page of the pageframe, the code would be as follows: IF THISFORM.curPage != 4 AND THISFORM.curPage = 4 ELSE && Resets the active page NODEFAULT THIS.PARENT.ActivePage = THISFORM.curPage ENDIF



STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0 for Windows.



Steps to Reproduce Problem
 Create a new form named zJunk. Add a pageframe to the form. Set the PageCount to 4.  Add the following code to the Deactivate event of Page1: NODEFAULT  Add text labels to each of the four pages to identify each page. Save and run the form.</li> Click the Page4 tab.</li></ol>

Keywords: kbbug kbfix kbvfp500fix KB143296

-

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

© Microsoft Corporation. All rights reserved.