Page 1 of 1
Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:01 pm
by hrcap
Hi All
I hope that everyone is well.
I am a bit stuck....
On a card I have two hidden datagrids (DG) lets call them DG1 and DG2.
Everything is fine on desktop but on mobile...:
• If I make DG1 visible, view it, scroll it, and then hide it.... when I then make DG2 visible the scroll doesn't work on DG2
• If I make DG2 visible, view it, scroll it, and then hide it.... when I then make DG1 visible the scroll doesn't work on DG1
I have encountered a similar problem in the past where I have opened a data grid on top of a scrolling group (that I custom created), which has caused issues... to solve this all I do is delete the mobile scroller for the group underneath when I open the DG... then when I close the DG I re-establish the mobile scroller for the group underneath.
I am looking to do the same thing for the DG's... but I dont know how to do this... LiveCode creates the mobile scrollers automatically for the DGs and as such I dont know what they are called to delete them.
I hope that makes sense.
Many Thanks
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:16 pm
by stam
Did you copy the fist DG to make the second?
If so this is probably the root of your problem. DGs are complex beasts that sore properties in a substack of the main stack. In this case you’ll want to create a 2nd DG from scratch…
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:28 pm
by hrcap
Hi Stan, thanks for the feedback unfortunately this isn’t the case. I ran into the copy data grid issue early on in my live code discovery, and it caused such a headache that I wouldn’t make the same mistake again
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:31 pm
by stam
Can you post your code then? It may be there is something there that can be improved…
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:38 pm
by stam
Can you post your code then? It may be there is something there that can be improved…
Also: do u use a mobile scroller?
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 6:49 pm
by hrcap
Hi Stam
I’m not at my computer at this second, although I’m not sure in this case that the code will help, I am simply setting the visible of a Dg to true, and then hiding it…. Then making the 2nd dg visible
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 7:34 pm
by Klaus
Do you have/create a separate native scroller for each datagrid?
And do you also show/hide these scrollers accordingly?
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 8:00 pm
by hrcap
Hi Klaus
No I use the native scroller that is created automatically by the data grid.
What you are saying is effectively what I want to achieve (i think)… instead of using the native scroller for the dg that is auto created, I want to create my own, and then delete/hide it when I hide the dg.
Re: Delete Scroller datagrid on mobile
Posted: Sun Jun 26, 2022 8:23 pm
by Klaus
hrcap wrote: ↑Sun Jun 26, 2022 8:00 pm
...
No I use the native scroller that is created automatically by the data grid...
There is a automatically generated native scroller in the datagrid?
Never used a datagrid on mobile so far so you see mee puzzled!?
Re: Delete Scroller datagrid on mobile
Posted: Mon Jun 27, 2022 3:33 pm
by stam
i haven't (yet) written any apps for mobile, but my impression was that you need to check for environment and if mobile then create mobile scroller - and if switching between DGs you probably would have to delete the scroller and create a new one (although admittedly i have zero experience in this so far...)
Perhaps people with more mobile experience can chime in...
Re: Delete Scroller datagrid on mobile
Posted: Mon Jun 27, 2022 3:42 pm
by hrcap
Hi Stam
Thats exactly correct and a technique that I use regularly, the issue here is that the Mobile Scroller is created automatically for the Datagrid and I dont know what name they give to it in order for me to be able to delete it when I hide the DG
Re: Delete Scroller datagrid on mobile
Posted: Mon Jun 27, 2022 4:36 pm
by Klaus
What version of LC does automatically create a native scroller for a datagrid?
Re: Delete Scroller datagrid on mobile
Posted: Mon Jun 27, 2022 4:38 pm
by Klaus
You can let you answer all mobile controls, maybe that will give you some hint:
Code: Select all
on mouseup
answer the mobilecontrols
end mouseup
Re: Delete Scroller datagrid on mobile
Posted: Sun Jul 03, 2022 8:46 am
by hrcap
Thanks Klaus
I used this suggestion to help me rule out the fact that the problem wasn't what I thought it was.
SOLUTION:
When using DataGrid's on mobile don't change the layer of the DataGrid via code as this affects how the mobile scroller for the DG works.
NOTE:
When LiveCode auto creates the mobile scroller for a DataGrid it gives names the scroller as the Long ID of the group that it is is scrolling.
Many thanks for your suggestions.