Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NitPicking! Scrolling in a Grid...

Status
Not open for further replies.

DJVisuaL

Programmer
May 31, 2000
52
US
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
thanks
newboy
 
"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()


 
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...

thanks
DJ
 
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...

DJ
 
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.
 
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

Thanks
DJ
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top