Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Scroll Event
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01527274
Message ID:
01527291
Views:
92
This message has been marked as a message which has helped to the initial question of the thread.
Likes (1)
>>>>>In a grid dragging the mover or clicking the up or down arrows fires the scrolled event.
>>>>>
>>>>>What event is fired when you click the scroll bar in a grid between the mover and the up or down arrows?
>>>>
>>>>
>>>>Same
>>>
>>>Ugh. Thanks.
>>
>>
>>That was an easy one
>
>New question (hopefully harder):
>
>How can you determine what records are visible?


The only way I have found is to use a sort of Dynamicxxx(). Best is DynamicFontShadow()

Have at least one column with
  .DynamicFontShadow = [m.this.UpdateCollection(recno())]   && or record pk instead of recno()
Add a grid method: UpdateCollection(id)
Add a Collection to the grid


Now, each time UpdateCollection is called, you can test whether the id is in the collection (empty(collection.getkey(transf(m.id)))
If it is not in add it
.Collection.add(m.id, trans(m.id))

Each time the grid is refresh() or scrolled, the DynamicFontShadow will fire and you can add the Id's to the collection

The DynamicXXX fire from left to right, top to bottom. The first one added will be the top visible row of the grid

The key is to know when to clear the collection

(1) Do a bindevent on grid.Refresh - the delegate must be called before the refresh - clear the collection. The refresh will refill it

(2) Do a bindevent on scrolled - delegate must be called after scrolled
if the direction was vertical, clear the collection, call grid.RefillCollection ( see below)

(3) Do a bindevent on Resize - delegate must be called after scrolled
clear the collection, call grid.RefillCollection ( see below)


Add a property to the grid: HeightDelta, value 1

RefillCollection forces the dynamicXXX to be re-evaluated for the visible cells in a grid
&& Grid.RefillCollection 
store -m.this.HeightDelta to this.HeightDelta
this.height = m.this.Height + m.this.HeightDelta
same principle - download#37149
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform