Solved

Scrolling a grid

Posted on 2014-01-12
3
1,460 Views
Last Modified: 2014-01-13
I would like records in my grid to scroll automatically when I open the tab with the grid. I would like the selected record to be in the middle of the grid if possible, or as close to the middle as possible if there are no enough records to populate the whole grid. How can I do that?

Also, position of the slider of the grid is somewhat confusing. If there are just a few records at the top of the grid, the slider is still not in the uppermost position, which makes an impression that there are some records hidden above the grid top. How can I fix that?

VFP6.

Thank you.
0
Comment
Question by:VitalyNagy
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 39775893
If you place the following command to the Page.Activate code then it should position the active record in the middle of the grid:

THIS.YourGrid.SetFocus

Note: SetFocus will "center" the grid active record when it is outside the visible area only. To center the active record in all situations you will need to move it outside the visible are by DoScroll, e.g.


THIS.YourGrid.DoScroll(3)
THIS.YourGrid.DoScroll(3)
THIS.YourGrid.SetFocus

etc.  (Use DoScroll(2) if you are close to the table bottom.)

The impression with your slider is maybe correct. If there are deleted records at the beginning of your table and SET DELETED is ON then the first visible record is not the record No. 1 in the table so the grid does not show the slider at the top. It is a bug maybe but to check the first visible record would cost reasonable amount of time which results in grid freezing or delays...

The workaround is to create a temp table/cursor which will contain just visible data.

Above code was tested in VFP 9. VFP 6 may behave slightly differently. You should upgrade to VFP 9 ASAP because it becomes unavailable...
0
 

Author Comment

by:VitalyNagy
ID: 39777208
Thank you. Where can I buy FoxPro 9?
0
 
LVL 41

Expert Comment

by:pcelba
ID: 39777313
Boxed product is not available, some used copies are at eBay from time to time.

You may buy VFP 9 license in almost any softwarehouse which delivers Microsoft software, e.g. http://www.cdw.com/shop/products/Microsoft-Visual-FoxPro-Professional-Edition-v.-9.0-license/748846.aspx

Open License program has some additional requirements which will make your first purchase about $40 more expensive.

VFP 9 is also available as a part of MSDN subscription.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
If your vDisk VHD file gets deleted from the image store accidentally or on purpose, you won't be able to remove the vDisk from the PVS console. There is a known workaround that is solid.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now