Scrolling datagrid problem

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Scrolling datagrid problem

Post by matthellstrom » Thu Jul 23, 2015 5:25 pm

I have a datagrid (form) that has a place for an image but I don't load the image until they click on the row. This works fine, but then when I scroll up or down, the same image is shown every 5 rows, basically every time a new screen of rows is shown. What am I doing wrong? Here's the code from the on mouseUP function in the behavior script.

Code: Select all

   
on mouseUp pMouseBtnNum
   if pMouseBtnNum is 1 then
      set the filename of image "itemPic" of me to "https://gunarama.com/images/th/250/" & tCurrentItemArray[the dgLine of me]["web_pic"] & ".jpg"
   end if
end mouseUp
I left out all of the code that I don't think matters in this issue.

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: Scrolling datagrid problem

Post by matthellstrom » Thu Jul 23, 2015 5:33 pm

I guess I don't totally understand how the scrolling works. I know it uses on FillInData pDataArray to fill the lines as it scrolls, but if there is nothing in that function to fill the image what happens? The URL's are in the dgData, should I also have a flag for "displayImage" that gets set when they click on the row, then in the FillInData check that flag?

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm
Location: Alexandria, Virginia

Re: Scrolling datagrid problem

Post by sritcp » Fri Jul 24, 2015 1:08 pm

matthellstrom wrote:........... when I scroll up or down, the same image is shown every 5 rows, basically every time a new screen of rows is shown. ........
It appears that when you scroll (and let go of the mouse button) the mouseUp handler is triggered (it shouldn't if it is inside the row template behavior script; it will if it is in datagrid group script).
Try scrolling using the script; use

Code: Select all

scrollLineIntoView pLine
If the problem goes away, my diagnosis above is probably correct.

Regards,
Sri

matthellstrom
Posts: 31
Joined: Mon Apr 27, 2015 3:09 pm

Re: Scrolling datagrid problem

Post by matthellstrom » Fri Jul 24, 2015 6:29 pm

OK I'll try that. Thanks.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”