Page 1 of 1

Scrolling datagrid problem

Posted: Thu Jul 23, 2015 5:25 pm
by matthellstrom
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.

Re: Scrolling datagrid problem

Posted: Thu Jul 23, 2015 5:33 pm
by matthellstrom
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?

Re: Scrolling datagrid problem

Posted: Fri Jul 24, 2015 1:08 pm
by sritcp
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

Re: Scrolling datagrid problem

Posted: Fri Jul 24, 2015 6:29 pm
by matthellstrom
OK I'll try that. Thanks.