PUBLIC oTestForm SET CLASSLIB TO c:\test\scrollablecontainer\scrolltainer.vcx ADDITIVE oTestForm=NEWOBJECT("TestForm") oTestForm.Show() RETURN ************************************************** DEFINE CLASS TestForm AS form Top = 4 Left = 5 Height = 435 Width = 482 DoCreate = .T. Caption = "Container Scroll Test" Name = "TestForm" ADD OBJECT scrolltainer1 AS scrolltainer WITH ; Top = 10, ; Left = 25, ; Width = 310, ; Height = 185, ; Name = "Scrolltainer1" Procedure Init() With this.scrolltainer1 For q = 1 to 15 lcText = "txt" + Transform(q) .AddObject( lcText, "textbox" ) .&lcText..left = 20 .&lcText..top = q * 30 .&lcText..visible = .t. Next EndWith Endproc ENDDEFINE ************************************************** ************************************************** DEFINE CLASS scrollspinner AS spinner Height = 24 Width = 20 Name = "scrollspinner" PROCEDURE UpClick this.Parent.Scroll( -1 ) ENDPROC PROCEDURE DownClick this.Parent.Scroll( +1 ) ENDPROC ENDDEFINE ************************************************** DEFINE CLASS scrolltainer AS container Width = 200 Height = 200 *-- Offset on the Y axis. yOffset = 1 *-- Specifies the vertical scroll increment related to a vertical scroll bar. vScrollSmallChange = 10 Name = "scrolltainer" *-- Indicates if the form is ready (the scrollbar is set, etc). HIDDEN lready PROCEDURE Init If DoDefault() With this .newObject( "spnScroll", "scrollSpinner", .ClassLibrary ) .spnScroll.Width = 20 .spnScroll.visible = .t. .lReady = .t. .Resize() endwith EndIf ENDPROC PROCEDURE Resize DoDefault() If this.lReady With this.spnScroll .Height = this.Height .Left = this.Width - .Width EndWith endif ENDPROC *-- Scrolls the container content up or down. PROCEDURE scroll( tnDirection ) with this Local loMember, lnMove lnMove = tnDirection * .VScrollSmallChange .yOffset = .yOffset + lnMove For each loMember in .Controls If Lower( loMember.name ) # "spnscroll" loMember.Top = loMember.Top - lnMove endif Next .Scrolled( lnMove ) && Scrolled Event endwith EndProc *-- Indicates that the content of the container has scrolled. PROCEDURE scrolled( tnDirection ) ENDPROC ENDDEFINE **************************************************