Page 1 of 1

dgHilitedLine Function

Posted: Wed Aug 21, 2013 8:57 pm
by Babyprincess
Hi,

I am having a problem with this function. I managed to place my images in a datagrid, but the images are not displayed as thumbnails, they are just the various jpg file name. I am trying to use this function, so that when i click on one image name, the image would appear on the image area. Below is my code & i can't seem to see whats wrong. Please help me. This is the code in my button. Can someone guide me on how i can do this function.

on mouseUp
local tFolder

put field "Folder" into tFolder
set the defaultFolder to tFolder
put the files into x
set the dgText of group "Data Grid" to x

if pBtnNum is 1 then
put the dgHilitedLines of group "Data Grid" into theLine
put the dgDataOfLine[theLine] of group "Data Grid" into theDataA
put the dgDataOfLine[theLine]of group "Data Grid" into img "ImageArea"
answer theLine
end if

end mouseUp

Re: dgHilitedLine Function

Posted: Wed Aug 21, 2013 9:45 pm
by dunbarx
Hi.

The "files" returns a list of files in the defaultFolder. A dataGrid, when setting the "dgtext" is going to look for a tab and return delimited dataSet. I use dataGrids for simple text, but am no expert with datagrids that use images and other complex gadgetry. I suspect, though that your DG is simply doing what you told it, loading a return delimited list into the first column. And this assumes that you loaded your defaultFolder (tFolder) with a valid pathname.

Craig Newman

Re: dgHilitedLine Function

Posted: Wed Aug 21, 2013 10:33 pm
by Simon
Here:
http://lessons.runrev.com/s/lessons/m/d ... -of-people
That lesson include how to add images to a datagrid.

Simon

Re: dgHilitedLine Function

Posted: Thu Aug 22, 2013 11:40 am
by Klaus
Is it really neccessary to populate the datagrid every time when the user clicks?

Don't forget: http://www.hyperactivesw.com/revscriptc ... ences.html 8-)

Re: dgHilitedLine Function

Posted: Fri Aug 23, 2013 8:16 am
by Babyprincess
I dont really know how to explain my problem. Sorry guys, am very new to livecode actually. Well, this is how my live code looks like actually. I want to click on the image in the datagrid & then i want the image to get display'd on the image area. Can someone guide on hw i can proceed from here. ):
I've attach'd a snapshot my livecode

Thank you

Re: dgHilitedLine Function

Posted: Fri Aug 23, 2013 9:09 am
by Simon
Oh...errr...
This is for Android?
Well the path would be for the first item in your list:
c:\user\admin...\IMG-2013....jpg
so in the group DataGrid 1: -- if you didn't change it's name

Code: Select all

on mouseUp
   put the dgHilitedLines of group "DataGrid 1" into theLine
   put the dgDataOfLine[theLine] of group "DataGrid 1" into theDataA
   combine theDataA with space
   put theDataA 
-- set the filename of image "the image name" to field "the path shown in your image" & theDataA 
end mouseUp
Not sure if this will work on mobile at all.

Simon
EDIT: -- set the filename of image "the right hand image in your pic" to field "the path shown in your pic" & theDataA
Just trying to be clear