DataGrid Scroller

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Daveinthebigcity
Posts: 19
Joined: Wed Aug 27, 2014 12:13 am

DataGrid Scroller

Post by Daveinthebigcity » Tue Nov 24, 2015 12:22 pm

Hi Everyone!
I've added a data grid to my app with a native scroller (using code from one of the other forum help posts).
The scrolling function works absolutely perfectly. The only problem is that I'm unable to select anything from the grid UNTIL I've scrolled first.
The data grid is checking for the scrollerDidScroll and not for the on mouseUp event. How can I get it to check for both events so that the user can either scroll down the list or simply select the first item they want to open?
Thanks in advance.

Code: Select all


on openCard
create_scroller
end openCard

on mouseUp
//Do something//
end mouseUp

on closecard
   delete_scroller
end closecard

command create_scroller   
   put "DataGrid1" into tScrollerGroup
   
   if the environment <> "mobile" then
      exit create_scroller
   end if
   
   // Create native scroller object and save its ID in a local variable
   MobileControlCreate "scroller", DataGrid1
   put the result into sScrollerId
   
   // RECT is the area on the card where the SCOLLER should do its work
   MobileControlSet sScrollerId, "rect", (the rect of grp tScrollerGroup)
   
   put the width of grp tScrollerGroup into tWidth
   put the dgFormattedheight of grp tScrollerGroup into tHeight
   set the dgvScroll of grp tScrollerGroup to 0

   // WHAT part fo the datagrid shall be scrolled-> the complete datagrid
   MobileControlSet sScrollerId, "contentRect", (0,0,tWidth,tHeight)
   
   // Display SCROLLER
   MobileControlSet sScrollerId, "visible", "true"
   
   // the typical BUMP effect when you ge to the edge of the object
   mobileControlSet sScrollerId, "canBounce", "true"
   mobileControlSet sScrollerId, "pagingEnabled", "false"
   mobileControlSet sScrollerId, "canScrollToTop", "true"
   mobileControlSet sScrollerId, "delayTouches", "true"
   mobileControlSet sScrollerId, "canCancelTouches", "false"
end create_scroller


// Will be sent when the user actually SCROLLs with his finger
on scrollerDidScroll OffsetX, OffsetY
   lock screen
   set the dgvScroll of group "DataGrid1" to OffsetY
unlock screen
end scrollerDidScroll

// REMOVE natove object when card closes!!!!!
command delete_scroller
   if the environment <> "mobile" then
          exit delete_scroller
   end if
     MobileControlDelete sScrollerId   
end delete_scroller


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

Re: DataGrid Scroller

Post by quailcreek » Tue Nov 24, 2015 6:12 pm

Hi Dave,
What version of LC are you running. This was fixed in LC LiveCode Indy 7.1.1 (rc 3) and LC LiveCode Indy 8.0 (dp 9)

Here's the bug report.
http://quality.livecode.com/show_bug.cgi?id=16239
Tom
MacBook Pro OS Mojave 10.14

Daveinthebigcity
Posts: 19
Joined: Wed Aug 27, 2014 12:13 am

Re: DataGrid Scroller

Post by Daveinthebigcity » Tue Nov 24, 2015 6:19 pm

Hi,
Thanks for the reply. I ran an update and it said that I had the latest version. Clearly I don't as I've just checked and I'm on 7.0. I will update.
That is a big help!

Thanks very much.
Dave

Daveinthebigcity
Posts: 19
Joined: Wed Aug 27, 2014 12:13 am

Re: DataGrid Scroller

Post by Daveinthebigcity » Tue Nov 24, 2015 6:24 pm

Actually, on that subject. Do you have a direct link to the latest version? I keep trying to download it but the website is taking me in loops, and the software is still telling me that I'm up to date.
Thanks
Dave

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

Re: DataGrid Scroller

Post by quailcreek » Tue Nov 24, 2015 6:25 pm

Here's where you can download LC.

http://downloads.livecode.com/livecode/
Tom
MacBook Pro OS Mojave 10.14

rmuzzini
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Mon Oct 08, 2012 11:30 am

Re: DataGrid Scroller

Post by rmuzzini » Fri Dec 04, 2015 3:09 pm

quailcreek wrote:Hi Dave,
What version of LC are you running. This was fixed in LC LiveCode Indy 7.1.1 (rc 3) and LC LiveCode Indy 8.0 (dp 9)

Here's the bug report.
http://quality.livecode.com/show_bug.cgi?id=16239
actually, it was NOT fixed.
using LC 7.1.1 Indy rc4 (or 7.1.1 rc3, for not to speak about LC 7.0.6) this bug is still there, gathered together with the other thousands still open.

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

Re: DataGrid Scroller

Post by quailcreek » Fri Dec 04, 2015 6:56 pm

You are correct. I was fixed in LC 8 and it has always worked in LC 6
Tom
MacBook Pro OS Mojave 10.14

Post Reply