Microsoft KB Archive/138602

= ListBox Scroll Behavior Depends on Physical Dimensions =

Article ID: 138602

Article Last Modified on 2/11/2000

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q138602



SUMMARY
If the contents of a list box exceed what the list box can display without scrolling, you can only scroll to the last item in the list. If the contents of the list box display entirely in the list box, scrolling down and past the last item cycles the highlight bar back up to the first item in the list.



MORE INFORMATION
The scrolling behavior of a list box depends on the physical dimensions of the listbox. The following program demonstrates this behavior: *-- Instantiate a form based on custom form class, TestForm. frmMyForm = CREATEOBJECT("TestForm") frmMyForm.show

READ EVENTS

DEFINE CLASS TestForm AS FORM CAPTION    = "List Test" AUTOCENTER = .T.     HEIGHT      = 190 WIDTH      = 300
 * -- Define a custom class based on the FORM baseclass.

ADD OBJECT List1 AS LISTBOX ; WITH ; TOP           = 24, ; LEFT          = 24, ; HEIGHT        = 110, ; WIDTH         = 130, ; CAPTION       = "Next"
 * -- Add list box to the form.

ADD OBJECT cmdQuit AS COMMANDBUTTON ; WITH ; TOP           = 60, ; LEFT          = 180, ; HEIGHT        = 29, ; WIDTH         = 100, ; CAPTION       = "Quit"
 * -- Add command button to exit the program (form).

PROCEDURE Init THIS.LIST1.AddItem('One') THIS.LIST1.AddItem('Two') THIS.LIST1.AddItem('Three') THIS.LIST1.AddItem('Four') THIS.LIST1.AddItem('Five') THIS.LIST1.AddItem('Six') ENDPROC
 * -- Add custom code to the Init event of the form.

PROCEDURE cmdQuit.click THISFORM.Release CLEAR EVENTS ENDPROC
 * -- Add custom code to the Click event of cmdQuit.

ENDDEFINE Run this program. With the current Height property of the list box set to 110, there is not enough room in the list box to display the entire contents of the list box. Therefore, when you scroll down to the last item in the list box, the highlight bar stops on the last item.
 * -- End custom class definition.
 * -- End program.

To demonstrate the cyclical scrolling behavior, edit the program and change the Height property of the list box to 120. Then Rerun the program. Scroll down in the list box and notice that when you reach the last item in the list, the highlight bar cycles back up to the first item and starts scrolling down again.

Additional query words: VFoxWin

Keywords: KB138602

-

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

© Microsoft Corporation. All rights reserved.