Datagrid (Form)

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
pidobearBUSsb9q
Posts: 34
Joined: Fri Jul 13, 2012 8:40 am

Datagrid (Form)

Post by pidobearBUSsb9q » Fri Aug 10, 2012 7:03 am

Hi guys

I have put 3 images per rows for the template in a Datagrid
i got 1 custom property for each of there that contain a value(int)
how can i put those value in?
will the values of the custon property be the same in the datagrid if i got multiple rows

and it seem like i have a problem getting custom property from a image in a datagrid

THanks

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

Re: Datagrid (Form)

Post by Klaus » Fri Aug 10, 2012 11:56 am

Hi guy :)

we need more info!

How do you put the imafges into the grid? Copy the image to new image objects in the grid or as icons in buttons?
Where are the images with the custom properties located, how do you reference them in the grid?
What did you script so far?

Questions, questions, questions :)


Best

Klaus

pidobearBUSsb9q
Posts: 34
Joined: Fri Jul 13, 2012 8:40 am

Re: Datagrid (Form)

Post by pidobearBUSsb9q » Mon Aug 13, 2012 2:44 am

i am so sorry i am really confused with this too, still new to grid. so i do not know how to give a really good explanation.
be patient with me thanks :D

i put the image object in the grid as a template

Image

i did a RSS reader which grab the picture at the start but i cant get it to retrieve the info.

this is how i put inside the array

Code: Select all

put 0 into hello
   repeat for each line theLine in allItems
      if hello <= 3 then
         add 1 to hello
         add 1 to A
         put the customproperties[theLine] of this stack into theItem
         put theItem["thumbnail"] into theDataA[A]["Image URL"]
        
         
      else if hello <= 7 then
         add 1 to hello
         add 1 to B
         put the customproperties[theLine] of this stack into theItem
         put theItem["thumbnail"] into theDataA[B]["Image URL2"]
         
      else
         add 1 to hello
         add 1 to C
         put the customproperties[theLine] of this stack into theItem
         put theItem["thumbnail"] into theDataA[C]["Image URL3"]
         
      end if
   end repeat
   set the dgData of group "DataGrid 1" to theDataA
   //set the htmltext of field "title" to theOutput
   
   error revXMLText(theID)
   revDeleteXMLTree theID
   error "End of all Errors"
   //select line 1 of field "title"
   send selectionChanged to group "DataGrid 1"
end mouseUp

this is how i am trying to retrieve it

Code: Select all

on selectionchanged
put "item_" & [b]word 2 of the selectedLine of me[/b] into theLine <------ i need to grab this but i dont know how to grab from the    image.i think i lack this part only and i am done


put the customproperties[theLine] of this stack into theItem


   if theItem["content"] <> "" then
      put theItem["content"]  & return after theOutput
   else 
      put  theItem["description"]  & return after theOutput
   end if
   if theItem["pubDate"] <> "" then
      put "<p>Published on:" && theItem["pubDate"] & "</p>" & return after theOutput
   end if
   if theItem["author"] <> "" then
      put "<p>author:" && theItem["author"] & "</p>" & return after theOutput
   else if theItem["creator"] <> "" then
      put "<p>author:" && theItem["creator"] & "</p>" & return after theOutput
   end if
   
   
   
   if theItem["link"] <> "" then
      put "<p><a href=" & quote & theItem["link"] & quote & ">Click here to view Webpage</a></p>" & return after theOutput
   end if
set the htmltext of field "fieldText" to theOutput
end selectionchanged
thanks

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

Re: Datagrid (Form)

Post by Klaus » Mon Aug 13, 2012 3:23 pm

Hi,

still not sure if I understand, but it looks like you want to add the image to the htmltext, right?
Well, then you need to create the correct HTML tag for this :D

Try this:

Code: Select all

...
if theItem["link"] <> "" then
      put "<p><a href=" & quote & theItem["link"] & quote & ">Click here to view Webpage</a></p>" & return after theOutput
end if

## Preview image here:
if theItem["thumbnail"] <> "" then
      put "<p><img src=" & quote & theItem["thumbnail"] & quote & "></p>" & return after theOutput
   end if
set the htmltext...
...
Hint:
Create this little function, put in your stack script(s) and be happy:

Code: Select all

function q TheString
  return QUOTE & theString & QUOTE
end q
Will save a LOT of typing:
...
put "<p><a href=" & q(theItem["link"]) & "</p>" & return after theOutput
...
:D


Best

Klaus

pidobearBUSsb9q
Posts: 34
Joined: Fri Jul 13, 2012 8:40 am

Re: Datagrid (Form)

Post by pidobearBUSsb9q » Tue Aug 14, 2012 2:25 am

hi thanks for replying

that is something i have been looking for too but not what i want now thank anyway. :D


Previous version which select line to view different contents:
Image

new version which user select image to view different contents:
Image

i use this line to grab the content in the previous version:
put "item_" & word 2 of the selectedLine of me into theLine <------ i need to grab this but i dont know how to grab from the image.i think i lack this part only and i am done

but i do not know how to get the line from the image and i need to know how.
and how to i get the individual image in different rows inside the datagrid to respond as i cant set the setting as they are auto generated. Example: i selected image 1 from the 3rd row. :D

pidobearBUSsb9q
Posts: 34
Joined: Fri Jul 13, 2012 8:40 am

Re: Datagrid (Form)

Post by pidobearBUSsb9q » Thu Aug 16, 2012 2:29 am

Anyone can help with this problem?

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

Re: Datagrid (Form)

Post by Klaus » Thu Aug 16, 2012 11:40 am

Hi,

since you have 3 images in ONE row, "the selectedline" will only give you the LINE nr. where the 3 images reside
but not the number of the selected/clicked image!
So you might need to script a "mouseup" handler for the images, so you know WHICH image has been clicked.

But to be honest, I am still not sure what you are after... :D


Best

Klaus

Post Reply