DataGrid2 - What do you like, what don't you like

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Sun Apr 01, 2018 10:38 am

That looks more extensive than the one from the lesson which i use normally.
I will give that a try and see if it will scroll smoother.
It's only around 2100 lines and 4 columns of simple text, that should be doable i think and not heavy to cope with?

i did not quite get this sentence:
I set sTheDataGridName to the name of the DG in the preOpenCard handler.
Thanks Quailcreek!

Regards, Sphere

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Fri Aug 31, 2018 9:05 pm

@qualcreek

how exactly do i use the scrollerBeginDrag/scrollerendDrag and the other handlers when i have 3 DG's each on an own card. (because i think i need this: set the dgHilitedLine of grp sTheDataGridName to empty)
I don't think i can use it on each card? (because of the handler name)
If used on the stack i believe it's also not working. In the dictionary is written that it is send to the script which created the scroller.
of course i can put the name of the DG group into a global variable when the handler is inthe stack script , but i don't believe it works.
as still when i scroll it almost always mousesUP to the last row i touched.

i don't know if something like this can be used?
on scrollerBeginDrag pScrollerName

---edit---maybe i can use mousestilldown in the dg group and then set the dghilitedline to empty

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: DataGrid2 - What do you like, what don't you like

Post by quailcreek » Fri Aug 31, 2018 11:40 pm

HI Sphere,
You'll need to create a scroller for each DG and of course name the scrollers differently.

Code: Select all

on scrollerBeginDrag
local tScoller
  put mobileControlTarget() into tScoller
  if tScoller is "theDataGrid_1" then set the dgHilitedLine of grp "UpSellList_DG" to empty
  --   if tScoller is "theDataGrid_2" then set the dgHilitedLine of grp "usedTricks_DG" to empty
end scrollerBeginDrag

on scrollerEndDrag
local tScoller
  put mobileControlTarget() into tScoller
  if tScoller is "theDataGrid_1" then set the dgHilitedLine of grp "UpSellList_DG" to empty
  --   if tScoller is "theDataGrid_2" then set the dgHilitedLine of grp "usedTricks_DG" to empty
end scrollerEndDrag
Tom
MacBook Pro OS Mojave 10.14

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Sat Sep 01, 2018 1:26 pm

Great!
yes i have a scroller for each DG.

Yes that seems very logic, i did not think about this solution.
Going to test it right away.

Thanks very much qualcreek for your help!

Best regards,
Sphere

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Sat Sep 01, 2018 10:23 pm

Maybe there is a bug. (tested on lc901rc2)

According the dictionary, if you give a name to the scroller like: mobileControlCreate "scroller", "thenameofthescroller" then the mobilecontroltarget should return the name, if no name is given the id is returned.

But according to your example:
put mobileControlTarget() into tScoller , and then check
answer tScoller

gives a number, so the id of the created scroller, and not the name.
Therefore it does not work unfortunately.
and as i delete the created scroller when leaving the card, a new id nr will popup

Perhaps i can overcome this by not deleting the scroller and use if not exist then create a mobile controller, but i think i should return the name as written in the dictionary.

tomorrow i will check again or if you qualcreek or someone else can confirm, then if still the same result then i will create a bug report

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Sun Sep 02, 2018 12:00 pm


quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: DataGrid2 - What do you like, what don't you like

Post by quailcreek » Sun Sep 02, 2018 9:06 pm

Hi Sphere,
I get the name of the scroller. I tested in LC 9 rc2 and LC 8.1.10
Tom
MacBook Pro OS Mojave 10.14

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Sun Sep 02, 2018 9:26 pm

Hi qualcreek,

on what phone or emulator did you get it?
Android or iPhone? And what version?

--edit-- i see i forgot to mention on what phone i'm missing it, it's on an Android 6.0 and also emulator Android 6.0.

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: DataGrid2 - What do you like, what don't you like

Post by quailcreek » Sun Sep 02, 2018 11:25 pm

I don't think Android recognizes the scrollerBeginDrag and scrollerEndDrag handlers. That's one of the reasons LC is having trouble getting the native scroller to work x-platform. I did the test on my Android and no-joy. Works fine on iOS.

So if you're using LC 9 rc 2, why aren't you using the native scroller?
Tom
MacBook Pro OS Mojave 10.14

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Mon Sep 03, 2018 11:23 am

According the dictionary it is for iOs as well as Android.
Except for some command you can set something for deceleration, which only is iOs.

Well i could not get the scroller to work(that is i see thing about swipe left and right, and only a setting for static/scroller), except for how it is working now.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: DataGrid2 - What do you like, what don't you like

Post by jacque » Mon Sep 03, 2018 6:19 pm

I read your bug report. MobileControlTarget is a function so it needs parentheses. What do you get if you change it to: answer mobileControlTarget()?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Mon Sep 03, 2018 7:55 pm

Also then it only gives the id of the created scroller, instead of the scroller name.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: DataGrid2 - What do you like, what don't you like

Post by jacque » Mon Sep 03, 2018 9:37 pm

I wrote a test stack and tried it in both Android 6.0.1 and 9.0. I get the correct messages and the target is the name of the scroller. I used a log field instead of the answer command to eliminate the possibility that the answer dialog was interfering.

If you are only using the scroller name, you don't need to store the ID in a script-local. I stored it anyway, just to replicate your original scripts, but it didn't matter if it was there or not. It isn't really being used except to delete the scroller on closecard, and you could use the name for that instead.

I'll enclose it here so you can try it.

EDIT: I wrote it in LC 9 so the stack may not open in earlier versions.
Attachments
scrollerTest.livecode.zip
(3.73 KiB) Downloaded 203 times
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Mon Sep 03, 2018 9:52 pm

Thanks very much Jacque, will test it and let you know tomorrow.

Yes the ID is indeed not needed, you're right.

--EDIT-- quick test, works OK with begin and end scroller.

ok loosing my mind here...

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: DataGrid2 - What do you like, what don't you like

Post by quailcreek » Mon Sep 03, 2018 10:01 pm

To get the native scroller to work set the Show vScrollbar/Show hScrollbar in the DG PI under the Data Grid tab to true or auto. But like I said, it still has some problems.
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Talking LiveCode”