My app has a data grid with 50 rows. When a user taps one of the rows in the data grid, it opens another card where an image is displayed. When the user goes back to the card with the data grid, I want that card to open with the row that was just tapped, in view. For example, if the user taps on row 39 of the data grid, after viewing the image on the next card, I want row 39 to be in view when the comes back to the card with the data grid.
I am able to do this on the desktop version of LiveCode where I am building the app, however, when I test it on the iOS Simulator and my iPhone, when the card with the data grid is re-opened, the top rows of the data grid are displayed.
This is the code in the card script of the card that has the data grid:
Code: Select all
local gHilitedLine, pLine
on preOpenCard
put the dgHilitedLine of group "DataGrid 1" into gHilitedLine
put gHilitedLine into pLine
goToIndexedLine pLine
end preOpenCard
command goToIndexedLine pLine
dispatch "ScrollLineIntoView" to group "DataGrid 1" with pLine
set the dgHilitedLines of group "DataGrid 1" to pLine
end goToIndexedLine
Again, this code works perfectly fine on the desktop version of LiveCode where I'm building the app, but it doesn't work on the simulator or actual phone (e.g. if I tap row 39 on the simulator or the iPhone, when the card with the data grid is re-opened, it takes me to the top of the data grid, not lower where I can view row 39). Any thoughts?
Thanks,
Bellballer1