dgHilitedLine Function

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Babyprincess
Posts: 17
Joined: Sat Aug 10, 2013 3:23 pm

dgHilitedLine Function

Post by Babyprincess » Wed Aug 21, 2013 8:57 pm

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: dgHilitedLine Function

Post by dunbarx » Wed Aug 21, 2013 9:45 pm

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

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: dgHilitedLine Function

Post by Simon » Wed Aug 21, 2013 10:33 pm

Here:
http://lessons.runrev.com/s/lessons/m/d ... -of-people
That lesson include how to add images to a datagrid.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Klaus
Posts: 14190
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: dgHilitedLine Function

Post by Klaus » Thu Aug 22, 2013 11:40 am

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-)

Babyprincess
Posts: 17
Joined: Sat Aug 10, 2013 3:23 pm

Re: dgHilitedLine Function

Post by Babyprincess » Fri Aug 23, 2013 8:16 am

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
Attachments
sfdf.JPG
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. ):


Thank you

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: dgHilitedLine Function

Post by Simon » Fri Aug 23, 2013 9:09 am

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply