Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

NitPicking! Scrolling in a Grid...

NitPicking! Scrolling in a Grid...

NitPicking! Scrolling in a Grid...

Is there a way to make a grid scroll dynamically? instead of waiting for you to let go of the scrollbar before updating!?
I have noticed this happens in a ListBox when  the RecordSource is a table. I fixed it by using an array instead. But with Grids I don't think you can use arrays as a source?
The other thing is when you are using a grid and the active cell is in the first column and you push the left arrow key... Notice how the grid slides over and shows a wide empty column? Why does this happen? Is there a way to make the active cell wrap around without showing a huge non-existent column on the right?

Using VFP 5.0

RE: NitPicking! Scrolling in a Grid...

"you push the left arrow key... Notice how the grid slides over and shows a wide empty column? "

I don't see this behaviour in my grids, but I'm using VFP 6.

"Is there a way to make a grid scroll dynamically? "

Its probably not what you are looking for, but the technical answer is:  Grid.DoScroll()

Robert Bradley

FoxDev - Visual FoxPro Development

RE: NitPicking! Scrolling in a Grid...

Well what I mean by dynamic scrolling is mainly just when the user drags the vertical scrollbar in a grid.. it doesn't update dynamically as you move up and down like say a browser does.. drag your browsers scrollbar.. the screen moves as you drag.. thats what I want for my grid.. The grid doesn't have alot of data either so I'm guessing it is due to the fact that it's using a table which is on disk (same problem I had with listboxes) so it takes longer to update? dunno... I could use a cursor but then the user couldn't change the cell elements because a cursor is read-only
On the "phantom column" issue... I am thinking there is some hidden width property I need to change so that the extra space at the end of the last column doesnt show up when you push left while you are on the first column? I used builder to create the grid... I know there is Grid.Width but is there any secondary Width that defines the maximum space for all the columns to sit in? I'll keep looking...


RE: NitPicking! Scrolling in a Grid...

OK I fixed the last question... when you make a grid make sure the last column isn't to long or it will show a huge space when you scroll to the last column! Always leave a little space between the last column and the edge of the grid control WHEW ...
Still working on the dynamic scrolling...


RE: NitPicking! Scrolling in a Grid...

About Dynamic scrolling:
  I tried to investigate this problem for VFP 5.0, and was not successful completely. I don't know about VFP 6.0. However, any events (Even MouseDown) of grid occur only AFTER scrolling, despite I see MouseDown event call in the events log. So no way to make this for grid inside grid.
  However, it is possible to make it using custom scroll bar control. 2 images for arrows and 4 shapes. Call DoScroll method of Grid for scrolling. I see custom scroll bars made by such way in the source code of VFP standard wizards, so don't hesitate this way.

RE: NitPicking! Scrolling in a Grid...

OK I'm not sure where to find that Wizard... I dont see it in my wizards section when I create a form (I am new to VFP tho)
Do you mean creating a scrollbar myself and placing it on top of the grids scrolls on the form (covering them up) ?
I was thinking along different lines...
As an example: I know in MSVC++ If I wanted to make a grid control (if there is one) scroll dynamically I would try to find the base class it is formed and look for the event method there to control when someone grabs the scroll bar and then lets go
it could go as far back as a control class or window class...
However in VFP I'm not sure how to do this.. Maybe it isn't designed for this!?
Anyways if I could find the code for the grids scrollbar (release/clicK) I could probably make it scroll when they grab/move the scrollbar...
But maybe a custom scrollbar is the only way... if you come across anything let me know! I have this thread tagged


RE: NitPicking! Scrolling in a Grid...

  Right, make you own scrollbar. I some cases it is good idea to make you own grid also (VFP 6.0 quick enough to do this), but this may require a lot of effort (you know I suggest).
  Importent note: However, do not put it OVER the grid. VFP grid is quite special control. Its scroll bars and headers are 'Always-on-Top' items, so whatever you put over them will be covered by grid scroll bar or header. I found a way to correct this for headers, but not for scrollbars (no VFP grid event that fired AFTER scrollbar repainted).
  So, make grid without scrollbar (it have appropriate property). Place your own scrollbar to right of grid. Use sysmetric function to get it width.
  Right, VFP have 'scrolled' event, but do not have event like 'scrollbarhit' or something like this. Grid incorporates all internal functionality without exposing of its elements to programming interface, except columns and headers.

Volodymyr Grynchyshyn
VFP 5.0 or later programmer.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close