If you tap Cancel or Save, the appropriate action is performed on the database (i.e do nothing or update the database) and the app goes back to Card 1. When navigating back to Card 1 I want to make sure that the dgVscroll for the Data Grid is in the same position as it was before I navigated away from the card. Incidentally, when you navigate to Card 1 it queries the database and rebuilds the array loaded into the DataGrid so that any data changes made on Card 2 are shown in the Data Grid.
I call my "loadData" routine in the preOpenCard handler of Card 1 and the data is loaded successfully to the Data Grid. However if I also set the dgVscroll in the preOpenCard of Card 1 the Data Grid doesn't scroll to the correct location (well it does on the mac in LiveCode, but not on the iOS simulator or on my iPhone). If I move the set dgVscroll to the openCard handler the Data Grid scrolls to the correct location.... but you see it scroll and I'd like to get it set so that you don't see the Data Grid load & scroll as it looks odd and is visually distracting.
If you "lock screen" as the first instruction in preOpenCard and "unlock screen" as the last instruction of OpenCard then you don't see any scrolling, but all the visual effects are lost (unseen) and you just jump from Card 2 back to Card 1. Ok it works, but it doesn't look good.
My goal is to
Display Card 1 with a populated Data Grid
Navigate (slide) smoothly to Card 2 to show a specific entry
Slide smoothly back to Card 1 to show the list at the previously scrolled position.
Has anyone found a way to retain the visual effects when transitioning from one card to another and also pre-scrolling a Data Grid to the correct (previous) location without seeing the Data Grid actually scroll the data?
Here's what I've tried
Card 1 script - note this will scroll to the correct location in the DataGrid but you will see the DataGrid scroll or jump
Code: Select all
global gScroll -- somewhere to store the current dgVscroll (this is set when with a mouseUp handler on the DataGrid)
on preOpenCard
loadRecords
end preOpenCard
openCard
set the dgVscroll of group "DataGrid 1" to gScroll
end openCard
command loadRecords
-- run some code to load data from database into tArray
set the dgData of group "DataGrid 1" to tArray
end loadRecords
Code: Select all
global gScroll -- somewhere to store the current dgVscroll (this is set when with a mouseUp handler on the DataGrid)
on preOpenCard
loadRecords
set the dgVscroll of group "DataGrid 1" to gScroll
end preOpenCard
openCard
--
end openCard
command loadRecords
-- run some code to load data from database into tArray
set the dgData of group "DataGrid 1" to tArray
end loadRecords