Microsoft KB Archive/190818

= How To Programmatically Scroll a Visual FoxPro Form =

Article ID: 190818

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q190818



SUMMARY
Unlike the grid control, which has a scroll method that can be called to programmatically scroll through the grid records, a form has no such method.

You must use the SetViewPort method to programmatically scroll a Visual FoxPro 6.0 form.



MORE INFORMATION
The following sample form programmatically scrolls using the Page Up and Page Down keys:   Sample Code ---  PUBLIC oform oform=NewObject("ScrollForm") oform.show

DEFINE CLASS ScrollForm AS form Top = 0 Left = 0 Height = 101 Width = 168 ScrollBars = 2 Caption = "Use PgUp/PgDwn to Scroll Form" vertscrollpos = 0 Name = "Form1" ADD OBJECT shape1 AS shape WITH ; Top = 12, ; Left = 12, ; Height = 421, ; Width = 553, ; Name = "Shape1" ADD OBJECT command1 AS commandbutton WITH ; Top = 24, ; Left = 36, ; Height = 27, ; Width = 84, ; Caption = "Close", ; Name = "Command1" PROCEDURE KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl IF nKeyCode=3 Thisform.vertscrollpos=Thisform.vertscrollpos+Thisform.height Thisform.SetViewPort(0,Thisform.vertscrollpos) Thisform.Refresh ENDIF IF nKeyCode=18 Thisform.vertscrollpos=Thisform.vertscrollpos-thisform.height Thisform.SetViewPort(0,Thisform.vertscrollpos) Thisform.Refresh ENDIF ENDPROC PROCEDURE command1.Click thisform.release ENDPROC ENDDEFINE

Additional query words: kbOOP kbVFp600

Keywords: kbhowto kbcode KB190818

-

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

© Microsoft Corporation. All rights reserved.