I'm looking for a way to figure out whether the hilited line of a datagrid is visible when the user stops scrolling the lines in the datagrid. I think I can do it by checking if the dgHilitedLine is between the two values returned by the dgVisibleLines property of the datagrid but I can't figure out when and where to make that check.
Any ideas?
Thanks,
Pete
Datagrid scrolling question
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Contact:
Re: Datagrid scrolling question
If you are just monitoring the scrollbar then add a mouseUp handler to the data grid group script.
This doesn't take into account using the arrow keys or home/end/page up/page down keys.
Another approach might be to process the command that performs the actual scroll: _ScrollListV. Something like this in the Data Grid group script would trigger a command that can monitor the lines being changed.
Code: Select all
on mouseUp pBtnNum
if pBtnNum is 1 and word 1 of the target is "scrollbar" then -- works for both horizontal and vertical scrolling
-- user released scrollbar
end if
end mouseUp
Another approach might be to process the command that performs the actual scroll: _ScrollListV. Something like this in the Data Grid group script would trigger a command that can monitor the lines being changed.
Code: Select all
command _ScrollListV
-- if you just want to process when user finishes scrolling then cancel any messages
-- with "CheckMe" in them at this point.
send "CheckMe" to me in 20 milliseconds
pass _ScrollListV
end _ScrollListV
on CheckMe
-- todo: cancel any pending messages with "Checkme" in them
-- Check if line is in site
end CheckMe
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder