Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scroll vertical para rellenar formularios multipágina
Message
 
 
À
01/03/2002 02:27:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00626238
Message ID:
00627079
Vues:
20
Hola, José Luis.

A ver qué te parece este primer intento...

Habría que cambiar el spinner por algo mejor, tomar el mismo criterio para el scroll horizontal, y controlar que no se pueda pasar de más en uno u otro sentido, pero creo que el criterio general puede funcionar.

Saludos!
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
**************************************************
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform