Microsoft KB Archive/134312

= PRB: TabIndex Setting Does Not Activate Selected Form First =

Article ID: 134312

Article Last Modified on 2/15/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q134312



SYMPTOMS
Setting the TabIndex property of a form within a formset changes the activation order of the forms. However, the first form added to the formset will always be activated first although its TabIndex property is set to a value other than one.

The TabIndex property of a form within a formset can be used to determine the activation order of forms within a formset. By default, the first form added in a formset is activated first, the second form added is activated second, and so on. By changing around the TabIndex properties for all the forms within a formset, the activation order is changed and the form which has a TabIndex property of 1, is expected to be activated first.



RESOLUTION
By incorporating a few changes in the formset, it is possible to have the correct form be activated as the first form within a formset. Using the formset configuration as described below in the "More Information" section, the following changes correct the behavior.

Steps to Follow to Correct Behavior
 Create a new property for the formset called FirstTime.  In the Init method of the formset, add the following line of code: FirstTime=.T.                         In the Activate method of Form1 of the formset (Form1 is the first form added to the formset), add the following lines of code: IF thisformset.firsttime=.T.     NODEFAULT ThisFormSet.FirstTime=.F.     ThisFormSet.Form4.Command1.SetFocus ENDIF 



STATUS
Microsoft is researching this behavior and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
The following formset configuration illustrates resetting the TabIndex property does not result in the desired form being activated first.

Steps to Reproduce Behavior
 On the File menu, click New. Then click Form and New File. On the Form menu, click Create Form Set.</li> On the Form menu, click Add New Form three times. Form4 is the last form added to the formset.</li>  Change the TabIndex property of each form as follows: Form1 (TabIndex Property set to 2) Form2 (TabIndex Property set to 4) Form3 (TabIndex Property remains at 3) Form4 (TabIndex Property set to 1) </li> Add a command button to each form.</li>  In the click method of Form1, add the following line of code: ThisFormset.Release </li> Run the formset, and note that Form4 is not the first form activated as expected. However, the forms do cycle in their TabIndex order from that point on.</li></ol>

Additional query words: VFoxWin

Keywords: KB134312

-

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

© Microsoft Corporation. All rights reserved.