Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect ListBox Scroll
Message
From
16/09/2006 08:56:19
 
 
To
16/09/2006 07:01:40
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01154339
Message ID:
01154348
Views:
9
>How can I Detect that a user is now scrolling a Listbox when they click the UP/Down or by Dragging the Scroll Area. In Grids we have the SCROLLED and GRIDHITTEST events but not in Listbox. I was thinking of using the MOUSEDOWN/MOUSEUP events but how can I distinguish the scrollling from MouseUps and MouseDowns that are on other areas bearing in mind that the Listboxes are in varying widths.
>
>
>Fred

you can start with this ( it is not complete ):
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN

DEFINE CLASS form1 AS form

	Caption = "show a Listbox Scrolled event"
	ShowWindow = 2
	Autocenter	= .T.

	ADD OBJECT list1 AS ListBoxEx WITH ;
		RowSourceType = 1, ;
		RowSource = "A,B,C,D,E,E,F,G,H,I,Y,T,Y,G,F,R,E,D,E,R,R,R,ED,E,E,E,E,E,SD,S,S", ;
		Height = 182, ;
		Left = 32, ;
		Top = 20, ;
		Width = 151

	PROCEDURE list1.Scrolled(items)
		WAIT windows "scrolled"+STR(m.items) NOWAIT
	ENDPROC

ENDDEFINE

DEFINE CLASS ListBoxEx As ListBox
	HIDDEN  TopIndexLast
		TopIndexLast = 1

	PROCEDURE MouseWheel
		LPARAMETERS nDirection, nShift, nXCoord, nYCoord
		* VFP have a design bug and NODEF + baseclass::MouseWheel doesn't work
		NODEFAULT
		*RETURN ListBox::MouseWheel(nDirection, nShift, nXCoord, nYCoord)
		this.TopIndex = m.this.TopIndex - SIGN(m.nDirection)
	ENDPROC
	
	PROCEDURE MouseUp
		LPARAMETERS nButton, nShift, nXCoord, nYCoord
		this.TopIndex=m.this.TopIndex
	ENDPROC	

	PROCEDURE InteractiveChange
		this.TopIndex=m.this.TopIndex
	ENDPROC
	
	HIDDEN PROCEDURE TopIndex_Assign(TopIndex)
		This.TopIndex = m.TopIndex
		TopIndex = m.this.TopIndex- This.TopIndexLast
		IF EMPTY(m.TopIndex )
			RETURN
		ENDIF
		This.TopIndexLast = m.this.TopIndex
		RETURN this.Scrolled(m.TopIndex)
			
	PROCEDURE Scrolled(items)

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform