Solved

Scrolling a grid

Posted on 2014-01-12
3
1,540 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 42

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 42

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

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…
Use Windows Task Scheduler to print a Word document weekly so your printer ink won't dry out.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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