Microsoft KB Archive/130349

= PRB: Cannot Change ActivePage of a PageFrame with a Hot Key =

Article ID: 130349

Article Last Modified on 2/11/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q130349



SYMPTOMS
Under certain circumstances, the activepage of a pageframe object doesn't change when you press a hot key combination for a page.



CAUSE
The pageframe is not the only object on the form.



WORKAROUND
The pageframe container does not have a keypress method, so you need to modify the keypress method of the form to handle specific hot key combinations as in this example:

 Create a new form. Add a pageframe control, and change the name property to pgfexample. Set the caption of page1 in pgfexample to Page\<1. Set the caption of page2 in pgfexample to Page\<2.  Add the following code to the keypress method of the form: LPARAMETERS nKeyCode, nShiftAltCtrl DO CASE

*Check to see if ALT+1 is pressed CASE nKeyCode=120 and nShiftAltCtrl=4 this.pgfexample.activepage=1

*Check to see if ALT+2 is pressed CASE nKeyCode=121 and nShiftAltCtrl=4 this.pgfexample.activepage=2

ENDCASE  Run the Form. Press ALT+1 to change the active page of the pageframe to page1. Press ALT+2 to change the active page of pgfexample to page2.</li></ol>

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
This particular issue occurs only if the form contains objects other than the pageframe. In the example, pressing ALT+1 or ALT+2 would select page1 or page2 without the code if there were no other objects on the form. The code in the keypress event is useful when the form contains objects outside of the pageframe.

Additional query words: VFoxWin

Keywords: kbcode KB130349

-

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

© Microsoft Corporation. All rights reserved.