Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Displaying Records in a Grid
Message
From
22/08/2008 20:48:22
 
 
To
22/08/2008 00:19:29
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01341004
Message ID:
01341291
Views:
15
** Edit **

My problem below is solved. It actually is working. I did move the doScroll code to the grid's refresh() event, but I'm not convinced that it wasn't working all along.

When my doScroll code first runs, the grid DOES have focus, but strangely, both relativerow and activerow = 0. I put a wait window in grdTheGrid.when() to see when focus transfered to the grid. After completing the doScroll code, the when() fired two more times. I don't know why, but by the end of the process my code did run against the actual (non-zero) relativerow and activerow values.

I'm pleased that it's working now, but I don't know why the values were 0 on the first pass through the code, or why the code ran multiple times.

Bob


Stefan
I like this approach, but my normal use would be applied to:
Select TheTable     &&  RecordSource for grdTheGrid
Locate for TheTable.theField = something
thisform.grdTheGrid.setfocus()
thisform.grdTheGrid.PositionVisibleRows()
Thisform.grdTheGrid.refresh()
Where do I put the doScroll() code (I have it as a method that I created in the grid right now in grdTheGrid.PositionVisibleRows()
). It doesn't seem to be working. Debug shows me that both .activerow and .relativerow are zero when the code in PositionVisibleRows()
is running. I see it in code that says
with this
if .activerow <= .GridRowCount  && A Grid Variable that I created
  do while .relativerow < .activerow
    .doscroll(0)    
  enddo
any thoughts
Bob

>>I'm having trouble getting my records to show correctly in a grid. Sort of. They are all there, but sometimes if there are 5 records, only 3 will display, though the other two are at the top, but out of sight. As soon as I click on the scroll bar I can move up to them. Or with the arrow keys if I'm on a record. I know I'm not the only one to have this issue, so what do you guys do to get the records to look right? If there are a lot, then how do you get the current record to be in the middle of the grid? It annoys me and my users.
>>
>
>You can grid.DoScroll(0), for instance while .RelativeRow < 5 AND .ActiveRow > .RelativeRow.
>(.ActiveRow and .RelativeRow. are empty when the grid does not have the focus).
>
>
>hth
>-Stefan
Previous
Reply
Map
View

Click here to load this message in the networking platform