Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Display current row at the top of grid.
Message
From
16/02/1999 04:01:48
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
15/02/1999 22:09:30
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00187898
Message ID:
00187938
Views:
19
>I know I saw a thread on this question, but I can't find it.
>
>When you have grid on the form and you programmatically search for a record, then refresh the grid. The active record is displayed in the middle of the grid. Which I like, but my customer wants the active record to be displayed on the first row of the grid. How do I do this?
>
>TIA
>Robert
Robert,
1) You need relativerow property so grid should have focus.
2) You mimic scroll with doscroll().
* Lostfocus of search textbox
* If directly in grid (ie:inGrid class)
* no need for setfocus
thisform.lockscreen = .t.  && If want to hide scroll animation
with ThisForm.Grid1
	.setfocus  && Needed for relativerow
	do while .relativerow # 1 && Hit top row ?
		.doscroll(1) && Scroll down
	enddo
endwith	
ThisForm.Text2.setfocus && Get focus back to somewhere outside grid
thisform.lockscreen = .f.
Notice we always rely on the fact that a search in grid returns with a relativerow >= 1 and don't check if we should scroll up.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform