Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Rahul Moudgill
  Where is Rahul Moudgill?
 Toronto
 Canada
 Rahul Moudgill
 To: Sithu Kyaw
  Where is Sithu Kyaw?
 Yangon
 Myanmar
 Sithu Kyaw
 Tags
Subject: RE: Grid scroll programmatically
Thread ID: 365410 Message ID: 365448 # Views: 59 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Wednesday, December 26, 2012 1:17:21 PM         
   


> I have a grid and I'm trying to scroll the grid vertically to the respective row currently selected.
> For example, if the record pointer moves to the last record, the grid should be scrolled to the bottom.
> If the record pointer moves to the middle record, the grid should be scrolled to the middle.
>
> I tried to issue GO BOTTOM, the grid is not scrolled to the bottom.
> I think I need to do it explicitly with Grid.Scrolled().
> But, I don't know how to do it.
>
> With Regards,
> profile for Sithu on Stack Exchange, a network of free, community-driven Q&A sites


use Grid.Refresh() instead of Grid.Scrolled()

e.g.

PUBLIC oform1

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


DEFINE CLASS form1 AS form


	Height = 397
	Width = 281
	DoCreate = .T.
	AutoCenter = .T.
	Caption = "Example Grid.Refresh()"
	Name = "Form1"


	ADD OBJECT grid1 AS grid WITH ;
		ColumnCount = 1, ;
		DeleteMark = .F., ;
		Height = 312, ;
		Left = 45, ;
		Panel = 1, ;
		SplitBar = .F., ;
		Top = 9, ;
		Width = 190, ;
		HighlightStyle = 2, ;
		AllowCellSelection = .F., ;
		Name = "Grid1", ;
		Column1.Width = 149, ;
		Column1.Name = "Column1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 351, ;
		Left = 86, ;
		Height = 27, ;
		Width = 51, ;
		Caption = "Skip 1", ;
		Name = "Command1"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 351, ;
		Left = 143, ;
		Height = 27, ;
		Width = 51, ;
		Cancel = .T., ;
		Caption = "\<Close", ;
		Name = "Command2"


	PROCEDURE Load
		CREATE CURSOR Junk (col1 c(10))
		FOR i = 1 TO 100
			INSERT INTO junk VALUES(SYS(2015))
		NEXT 
		GO TOP 
	ENDPROC


	PROCEDURE command1.Click
		IF !EOF([Junk])
			SKIP IN Junk
			IF EOF([Junk])
				GO BOTTOM in Junk
			ENDIF 
		ENDIF 
		thisform.grid1.Refresh()

	ENDPROC


	PROCEDURE command2.Click
		thisform.Release()
	ENDPROC


ENDDEFINE


Rahul

ENTIRE THREAD

Grid scroll programmatically Posted by Sithu Kyaw @ 12/26/2012 7:15:50 AM
RE: Grid scroll programmatically Posted by mk sharma @ 12/26/2012 7:22:42 AM
RE: Grid scroll programmatically Posted by Sithu Kyaw @ 12/26/2012 8:06:56 AM
RE: Grid scroll programmatically Posted by David Mustakim @ 12/26/2012 8:52:51 AM
RE: Grid scroll programmatically Posted by Sithu Kyaw @ 12/28/2012 6:14:44 AM
RE: Grid scroll programmatically Posted by Rahul Moudgill @ 12/26/2012 1:17:21 PM
RE: Grid scroll programmatically Posted by Sithu Kyaw @ 12/28/2012 6:15:19 AM