Delete Scroller datagrid on mobile

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Delete Scroller datagrid on mobile

Post by hrcap » Sun Jun 26, 2022 6:01 pm

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

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Delete Scroller datagrid on mobile

Post by stam » Sun Jun 26, 2022 6:16 pm

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…

hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Re: Delete Scroller datagrid on mobile

Post by hrcap » Sun Jun 26, 2022 6:28 pm

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

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Delete Scroller datagrid on mobile

Post by stam » Sun Jun 26, 2022 6:31 pm

Can you post your code then? It may be there is something there that can be improved…

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Delete Scroller datagrid on mobile

Post by stam » Sun Jun 26, 2022 6:38 pm

Can you post your code then? It may be there is something there that can be improved…

Also: do u use a mobile scroller?

hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Re: Delete Scroller datagrid on mobile

Post by hrcap » Sun Jun 26, 2022 6:49 pm

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Delete Scroller datagrid on mobile

Post by Klaus » Sun Jun 26, 2022 7:34 pm

Do you have/create a separate native scroller for each datagrid?
And do you also show/hide these scrollers accordingly?

hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Re: Delete Scroller datagrid on mobile

Post by hrcap » Sun Jun 26, 2022 8:00 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Delete Scroller datagrid on mobile

Post by Klaus » Sun Jun 26, 2022 8:23 pm

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? :shock:
Never used a datagrid on mobile so far so you see mee puzzled!?

stam
Posts: 2635
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: Delete Scroller datagrid on mobile

Post by stam » Mon Jun 27, 2022 3:33 pm

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...

hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Re: Delete Scroller datagrid on mobile

Post by hrcap » Mon Jun 27, 2022 3:42 pm

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Delete Scroller datagrid on mobile

Post by Klaus » Mon Jun 27, 2022 4:36 pm

What version of LC does automatically create a native scroller for a datagrid?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Delete Scroller datagrid on mobile

Post by Klaus » Mon Jun 27, 2022 4:38 pm

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

hrcap
Posts: 131
Joined: Mon Jan 14, 2019 5:20 pm

Re: Delete Scroller datagrid on mobile

Post by hrcap » Sun Jul 03, 2022 8:46 am

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.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”