Reference DataGrid or Data Array?

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
Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Reference DataGrid or Data Array?

Post by Bellballer1 » Fri Jul 17, 2020 7:23 am

Reference the DataGrid or theData Array?

Hello,

I am working on an app that has a Map and a DataGrid. The map uses the LiveCode MapKit external, mergMK.

On the card with the mergMK mapkit (card “map”), when the user touches the callout, I want the correct image to open on another card (card “display”), where the user will see a larger image of the thumbnail image they just touched.

HERE is the code (on card “map”)

command mergMKAnnotationCalloutTapped pID, gHilitedLine, gImageIcon
get the dgData of group "DataGrid 1" of this stack
put the dgDataOfLine[pID] of group "DataGrid 1" of this stack into gImageIcon
set the cImageFilename of card "display" of this stack to gImageIcon["btn icon"]
lock screen for visual effect
go to card "display" of this stack
unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped

The above code will GO TO card “display” but no image appears.

My confusion about whether to reference the DataGrid or theData Array happens because on card “list”, which also contains the DataGrid, I have the following code:

command uiPopulatePeople
put specialFolderPath("desktop") & "/Images/" into theImageFolder

put “123 Main Street" into theDataA[1]["address"]
put “Old Glass Tower" into theDataA[1]["title"]
put theImageFolder & “Glass Tower small.jpg” into theDataA[1]["image URL"]
put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]
put “Photo Credit information" into theDataA[1]["credit"]

lock screen
set the dgData of group "DataGrid 1" to theDataA
set the dgHilitedLines of group "DataGrid 1" to 1
unlock screen
end uiPopulatePeople

I have approximately 10 images so it goes from theDataA[1] to theDataA[10]. I want the mergMKAnnotationCalloutTapped on card “map” to reference the line with….
“put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon”].”

However, for the DataGrid, I don’t use all of the array.

on FillInData pDataArray
set the text of field "address" of me to pDataArray["address"]
set the text of field "title" of me to pDataArray[“title”]
set the filename of image "image" of me to pDataArray["Image URL”]
--set the short id of btn "image" of me to pDataArray[“image”]**I would prefer to use a button on the Row Template instead of an image object.
end FillInData

So in the mergMKAnnotationCalloutTapped handler, I’m confused if I should be using the dgData (or dgText) since I don’t technically use the line of code that shows the larger image on the DataGrid.

ADDITIONALLY, as you can probably see from the code I included, I’m having to use a specialFolderPath to get the small images into an image object on the Row Template of the DataGrid. For all of the other images I’m using in the app, I was able to “import as control” and put them on the last card of my stack (card “resources”). Elsewhere in the stack I am using buttons to display the images, but I am not sure how to reference the images by using a button on the row template. From what I’ve been able to gather in the LiveCode Forums, I need to import the images onto the same stack as the row template, but I have not been successful in doing so.

Any suggestions or tips on my issues would be greatly appreciated!

Charlie

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference DataGrid or Data Array?

Post by Klaus » Fri Jul 17, 2020 2:08 pm

Hi Charlie,

not sure I understand you completely, but I will try...

And please use the CODE tags to format your script(s)!
Paste the script here, select the text of the script and click the CODE tags -> </> above!
Bellballer1 wrote:
Fri Jul 17, 2020 7:23 am
...
On the card with the mergMK mapkit (card “map”), when the user touches the callout, I want the correct image to open on another card (card “display”), where the user will see a larger image of the thumbnail image they just touched.

HERE is the code (on card “map”)

Code: Select all

command mergMKAnnotationCalloutTapped pID, gHilitedLine, gImageIcon
   get the dgData of group "DataGrid 1" of this stack
   put the dgDataOfLine[pID] of group "DataGrid 1" of this stack into gImageIcon
   set the cImageFilename of card "display" of this stack to gImageIcon["btn icon"]
  lock screen for visual effect
   go to card "display" of this stack
   unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped
The above code will GO TO card “display” but no image appears.
I do not see any handler that should display that image in the rest of your script(s)?
Just setting a custom property does not display an image.
Bellballer1 wrote:
Fri Jul 17, 2020 7:23 am
...
My confusion about whether to reference the DataGrid or theData Array happens because on card “list”, which also contains the DataGrid, I have the following code:

Code: Select all

command uiPopulatePeople
   put specialFolderPath("desktop") & "/Images/" into theImageFolder

   put “123 Main Street" into theDataA[1]["address"]
   put “Old Glass Tower" into theDataA[1]["title"]
   put theImageFolder & “Glass Tower small.jpg” into theDataA[1]["image URL"]
    put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]
   put “Photo Credit information" into theDataA[1]["credit"]
  
   lock screen
   set the dgData of group "DataGrid 1" to theDataA  
   set the dgHilitedLines of group "DataGrid 1" to 1
   unlock screen 
end uiPopulatePeople
I have approximately 10 images so it goes from theDataA[1] to theDataA[10]. I want the mergMKAnnotationCalloutTapped on card “map” to reference the line with….
“put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon”].”

However, for the DataGrid, I don’t use all of the array.

Code: Select all

on FillInData pDataArray
  set the text of field "address" of me to pDataArray["address"]
  set the text of field "title" of me to pDataArray[“title”]
  ## set the filename of image "image" of me to pDataArray["Image URL”]
  
  ## If you want to display an image inside of a button, 
  ## you have to set the ICON of that button to the id of your image
  set ICON of btn "image" of me to pDataArray[“btn icon”]
  ## **I would prefer to use a button on the Row Template instead of an image object.
end FillInData
Bellballer1 wrote:
Fri Jul 17, 2020 7:23 am
...
So in the mergMKAnnotationCalloutTapped handler, I’m confused if I should be using the dgData (or dgText) since I don’t technically use the line of code that shows the larger image on the DataGrid.
the DGTEXT of grp "datagrid is a TAB and CR delimited list of simple text
the DGDATA of grp "datagrid" is an ARRAY
That is the difference. You choose what fits the situation! :-)
Bellballer1 wrote:
Fri Jul 17, 2020 7:23 am
...
ADDITIONALLY, as you can probably see from the code I included, I’m having to use a specialFolderPath to get the small images into an image object on the Row Template of the DataGrid. For all of the other images I’m using in the app, I was able to “import as control” and put them on the last card of my stack (card “resources”). Elsewhere in the stack I am using buttons to display the images, but I am not sure how to reference the images by using a button on the row template. From what I’ve been able to gather in the LiveCode Forums, I need to import the images onto the same stack as the row template, but I have not been successful in doing so.
Add all of your files and folders, like -> Images to your standalone via the "Copy files" tab in the "Standalone Application Settings"
Then you will find it in your standalone in -> specialfolderpath("resources")
This folder does also work in the IDE and point to the folder that contains your current stack, very handy!

Hope that helps!


Best

Klaus

Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Re: Reference DataGrid or Data Array?

Post by Bellballer1 » Fri Jul 17, 2020 4:03 pm

Hi Klaus,

Thank you very much for the reply. I apologize for not using code tags to format my scripts in the earlier post.

So here are all the handlers that I am attempting to use to display the image. The image should be displayed on card “display” in a larger version than what appears on the thumbnail that shows up on the map. Both the smaller thumbnail and the larger image are saved on my card “resources” (imported as controls).

On card “map”

Code: Select all

command mergMKAnnotationCalloutTapped pID, gHilitedLine, gImageData
  get the dgData of group "DataGrid 1" of this stack
   put the dgDataOfLine[pID] of group "DataGrid 1" of this stack into gImageIcon
   set the cImageFilename of card "display" of this stack to gImageIcon["btn icon"]
  lock screen for visual effect
   go to card "display" of this stack
   unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped
Script for group “DataGrid 1”

Code: Select all

on mouseUp
   local gHilitedLine, gImageData, gImageCredit, gImageIcon
 put the dgHilitedLine of group "DataGrid 1" into gHilitedLine

 put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into gImageCredit
 set the cImageDataName of card "display" to gImageCredit["credit"]

 put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into gImageIcon
 set the cImageIconName of card "display" to gImageIcon["btn icon”]

   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "flip right veryfast"  
end mouseUp
Script on card “display”

Code: Select all

on openCard
   set the text of field "credit" to the cImageDataName of this card
   set the icon of btn "display" to the cImageIconName of this card
end openCard

on closeCard
   set the icon of btn "display" to empty
   set the text of field "credit" of card "display" to empty
end closeCard
And then on card “list” that also contains the DataGrid, I have this...

Code: Select all

command uiPopulatePeople
   put specialFolderPath("desktop") & "/Images/" into theImageFolder

   put “123 Main Street" into theDataA[1]["address"]
   put “Old Glass Tower" into theDataA[1]["title"]
   put theImageFolder & “Glass Tower small.jpg” into theDataA[1]["image URL"]
    put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]
   put “Photo Credit information" into theDataA[1]["credit"]
  
   lock screen
   set the dgData of group "DataGrid 1" to theDataA  
   set the dgHilitedLines of group "DataGrid 1" to 1
   unlock screen 
end uiPopulatePeople
I have approximately 10 images so it goes from theDataA[1] to theDataA[10]. I want the mergMKAnnotationCalloutTapped on card “map” to reference the line with….
“put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon”].”

So my question is how do I display the image on card "display" when the user touches the Tapout on the map (on card "map")? The code I have above gets me to card "display" but without the corresponding image (i.e. I can't seem to get it to read line - "put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]", for example).

I am confused if I even need to use things like "the DGTEXT" or "the DGDATA" since the image I want to use is not on the Row Template and does "DG" even apply in these cases? If I do need to use one, I would prefer the DGDATA since I already have the array set up.

Code: Select all

on FillInData pDataArray
set the text of field "address" of me to pDataArray["address"]
set the text of field "title" of me to pDataArray[“title”]
set the filename of image "image" of me to pDataArray["Image URL”]
--set the short id of btn "image" of me to pDataArray[“image”]**I would prefer to use a button on the Row Template instead of an image object.
 
end FillInData

Hopefully this makes a little more sense now that I included all of the handlers I am trying to use in order to get the image to display. My guess is that its something simple and I'm over thinking things. Again, any tips or suggestions would be greatly appreciated.

I will also take another look at your suggestion to add all my images files via the "Standalone Application Settings." I have done that, but have not been using "specialfolderpath("resources")

Warm regards,
Charlie

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference DataGrid or Data Array?

Post by Klaus » Sat Jul 18, 2020 11:25 am

Hi Charlie,

some hints, see my comments:

Code: Select all

command mergMKAnnotationCalloutTapped pID, gHilitedLine, gImageData
   ## You do not need the complete data, just the dgdataofline[]
   ## get the dgData of group "DataGrid 1" of this stack

   ## if we are already IN THIS STACK, no need to mention it:
   ## put the dgDataOfLine[pID] of group "DataGrid 1" of this stack into gImageIcon
   put the dgDataOfLine[pID] of group "DataGrid 1" into gImageIcon
   set the cImageFilename of card "display" to gImageIcon["btn icon"]
   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped
Group Datagrid 1:

Code: Select all

on mouseUp
   local gHilitedLine, gImageData, gImageCredit, gImageIcon
   put the dgHilitedLine of group "DataGrid 1" into gHilitedLine

  ## put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into gImageCredit
  ## set the cImageDataName of card "display" to gImageCredit["credit"]
  ## put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into gImageIcon
  ## set the cImageIconName of card "display" to gImageIcon["btn icon”]

  ## The DGDATAOFLINE already contains all neccessary info you need, so fetching this info ONCE is enough
  put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into tData
  set the cImageDataName of card "display" to tData["credit"]
  set the cImageIconName of card "display" to tData["btn icon”]

   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "flip right veryfast"  
end mouseUp
Card "Display"

Code: Select all

on openCard
   set the text of field "credit" to the cImageDataName of this card
   set the icon of btn "display" to the cImageIconName of this card
end openCard

on closeCard
   set the icon of btn "display" to empty
   set the text of field "credit" of card "display" to empty
end closeCard
So far everything looks good!

Datagrid on card "list"

Code: Select all

command uiPopulatePeople
   ## If you put your folder Images into the folder with "this" stack, 
   ## then you can also use this in the IDE and in the later runtime!
   
   ## Hint: iOs and Android are CASE sensitive operating systems. Images <> images
   ## So maybe you want to switch to all lower case for your file- and foldernames?
   ## This way you do no need to rember if you had used upper case or not! :-)
   put specialFolderPath("resources") & "/Images/" into theImageFolder

   put “123 Main Street" into theDataA[1]["address"]
   put “Old Glass Tower" into theDataA[1]["title"]
   put theImageFolder & “Glass Tower small.jpg” into theDataA[1]["image URL"]
   
   ## Here we have a problem with the QUOTES  and I doubt that LC really compiled this!
   ## put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]
   put the short id of image “Glass Tower large.jpg" of card "resources" into theDataA[1]["btn icon"]
   put “Photo Credit information" into theDataA[1]["credit"]
  
   lock screen
   set the dgData of group "DataGrid 1" to theDataA  
   set the dgHilitedLines of group "DataGrid 1" to 1
   unlock screen 
end uiPopulatePeople
Did you check if -> the cImageIconName of card "display" contains the correct number or any data at all?
So my question is how do I display the image on card "display" when the user touches the Tapout on the map (on card "map")? The code I have above gets me to card "display" but without the corresponding image (i.e. I can't seem to get it to read line - "put the short id of image “Glass Tower large.jpg of card "resources" into theDataA[1]["btn icon"]", for example).
See above, maybe that was the problem?
I am confused if I even need to use things like "the DGTEXT" or "the DGDATA" since the image I want to use is not on the Row Template and does "DG" even apply in these cases? If I do need to use one, I would prefer the DGDATA since I already have the array set up.
Sorry, don't understand?
So image "image" is NOT part of the datagrid? :shock:

Code: Select all

on FillInData pDataArray
  set the text of field "address" of me to pDataArray["address"]
  set the text of field "title" of me to pDataArray[“title”]
  set the filename of image "image" of me to pDataArray["Image URL”]
  --set the short id of btn "image" of me to pDataArray[“image”]**I would prefer to use a button on the Row Template instead of an image object.
end FillInData
Code is correct.


Best

Klaus

Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Re: Reference DataGrid or Data Array?

Post by Bellballer1 » Mon Jul 20, 2020 5:33 am

Hello Klaus,

I incorporated the changes you suggested regarding using specialFolderPath(“resources”), but nothing seems to work in terms of getting the images stored in a folder, into the image object on my data grid.

Code: Select all

command uiPopulatePeople
   if the environment is “development” then put “/user/charlie/desktop/images/“ into theImageFolder
else
put specialFolderPath(“resources”) & “/images/“ into theImageFolder

   put “123 Main Street" into theDataA[1]["address"]
   put “Old Glass Tower" into theDataA[1]["title"]
   put theImageFolder & “Glass Tower small.jpg” into theDataA[1]["image URL"]
    put the short id of image “Glass Tower large.jpg” of card "resources" into theDataA[1]["btn icon"]
   put “Photo Credit information" into theDataA[1]["credit"]
  
   lock screen
   set the dgData of group "DataGrid 1" to theDataA  
   set the dgHilitedLines of group "DataGrid 1" to 1
   unlock screen 
end uiPopulatePeople
The images appear in “development” (in my desktop stack), but nothing appears when on the simulator. I’ve also tried using specialFolderPath(“engine”) and specialFolderPath{“preferences”), but nothing works. My computer is using MacOS Catalina (10.15.4) and I’ve read in some of the recent LiveCode forums that it may no longer be possible to access anything directly in the applications’ folder with this OS. Hopefully I'm wrong about that.

I’ve also read in other posts of yours that you recommend using buttons rather than an image object to display images. A button would be my preference because I can import the images directly only my “resources” card (through “import as control”). However, I’m unsure as to how to set it up in FillInData. This is what I currently have:

Code: Select all

on FillInData pDataArray
   set the text of field "title" of me to pDataArray["title"]
   set the text of field "address" of me to pDataArray["address"]
    set the filename of image "image" of me to pDataArray["Image URL"]
end FillInData
My current Row Template consists of fields for “title” and “address” and the image object “image.” When I take out the image object and use a button instead, I get errors messages like “no such object.”

I’ve tried including this line in the FillInData when I substitute a button icon for the image object:

Code: Select all

 set the icon of btn "image" of me to pDataArray[“icon"]
And something like the following in the uiPopulatePeople handler

Code: Select all

put the short id of image  “Glass Tower small.jpg” into theDataA[1][“icon"]
Nothing I have tried has worked.

Also, I tried your suggestion and checked to see if the cImageIconName of card “display” contains the correct number or any data. No data is being transferred to card “display” (i.e. the icon of button "display" is empty).

Code: Select all

command mergMKAnnotationCalloutTapped pAnnotationID, gHilitedLine, gImageData 
   try
   put the dgDataOfLine[pAnnotationID] of group "DataGrid 1" into tData
   set the cImageIconName of card "display" to tData["btn icon"]
catch e
   answer e
end try

   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped
I’m kind of surprised because I use pretty much the same code here (for group “DataGrid 1”) and it puts the proper image into button “display” on my card “display.”

Code: Select all

on mouseUp
   local gHilitedLine, gImageData, gImageCredit, gImageIcon
   
   put the dgHilitedLine of group "DataGrid 1" into gHilitedLine
   
   put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into tData
   set the cImageDataName of card "display" to tData["credit"]
   set the cImageIconName of card "display" to tData["btn icon"]
 
   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "flip right very fast"
   
end mouseUp
This is the current code on card "display"

Code: Select all

on openCard
   --set the filename of image "display" to the cImageFileName of this card
   set the text of field "credit" to the cImageDataName of this card
   set the icon of btn "display" to the cImageIconName of this card
   answer the icon of btn "display"
end openCard

on closeCard
   --set the filename of image "display" to empty
   set the icon of btn "display" to empty
   set the text of field "credit" of card "display" to empty
end closeCard
In summary, I am trying to figure out what is going wrong with both the use of the specialFolderPath, and the issue with the mergMKAnnotationCalloutTapped handler. Any insight you or others might have, would be greatly appreciated.

Best regards,

Charlie

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference DataGrid or Data Array?

Post by Klaus » Mon Jul 20, 2020 3:00 pm

1. Did you add the folder "Images" to your runtime via the "Copy files" tab in the "Standalone Appliction Settings"?
If not, there will be no images in your runtime!

2. Why not put that folder into the folder that contains your current stack?
That way no need for a IF THEN clause here:

Code: Select all

command uiPopulatePeople
   ##  if the environment is “development” then put “/user/charlie/desktop/images/“ into theImageFolder
  ##else
  put specialFolderPath(“resources”) & “/images/“ into theImageFolder
...
3.
My current Row Template consists of fields for “title” and “address” and the image object “image.” When I take out the image object and use a button instead, I get errors messages like “no such object.”
If you have added the button to the row template then this syntax of the FILLINDATA handler of the datagrid is correct, given you named your button "image"! You DID add the button there, right?

Code: Select all

...
set the icon of btn "image" of me to pDataArray[“icon"]
...
I did not mean something like this with "check if the custom property" is correct:

Code: Select all

command mergMKAnnotationCalloutTapped pAnnotationID, gHilitedLine, gImageData 
  ## try
   put the dgDataOfLine[pAnnotationID] of group "DataGrid 1" into tData
   set the cImageIconName of card "display" to tData["btn icon"]
   ## catch e
   ## answer e
   ##  end try
...
This will probably never fail, so this is nothing that you need to TRY!

Code: Select all

on openCard
   --set the filename of image "display" to the cImageFileName of this card
   set the text of field "credit" to the cImageDataName of this card
   set the icon of btn "display" to the cImageIconName of this card
   answer the icon of btn "display"
end openCard
So the answer dialog is EMPTY here?
But the text in field "credit" is correct?

Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Re: Reference DataGrid or Data Array?

Post by Bellballer1 » Mon Jul 20, 2020 6:23 pm

Hi Klaus,
Thanks again for looking at this.
1. Did you add the folder "Images" to your runtime via the "Copy files" tab in the "Standalone Appliction Settings"?
If not, there will be no images in your runtime!
2. Why not put that folder into the folder that contains your current stack?
That way no need for a IF THEN clause here:
I did add the folder "images" this way. I used the IF THEN clause as a way to test the special folder path identifiers. That folder is the one that I copied into the "Copy Files" in the "Standalone Application Settings". It shows up there (highlighted in blue).

If I include the following, the images do not appear on the data grid on my desktop app or on the simulator. I have not been able to get any images to appear on the data grid when I run the simulator!

Code: Select all

command uiPopulatePeople  
   put specialFolderPath("resources") & "/images/" into theImageFolder
….
If I have this, the images appear on the datagrid on my desktop app, but not on the simulator.

Code: Select all

command uiPopulatePeople  
   put specialFolderPath("desktop") & "/images/" into theImageFolder
….
If you have added the button to the row template then this syntax of the FILLINDATA handler of the datagrid is correct, given you named your button "image"! You DID add the button there, right?
I did add the button to the row template, named it "image", and added that syntax to the FILLINDATA handler. After I add all of that and hit "Refresh Data Grid", I get the error message "An error has occurred in the behavior of the row template: Chunk: no such object." Everything works if I have the image object on the row template (but doesn't work if I have a button object on the row template instead of the image object).

Code: Select all

on FillInData pDataArray
   set the text of field "title" of me to pDataArray["title"]
   set the text of field "address" of me to pDataArray["address"]
   set the icon of btn "image" of me to pDataArray["icon"]
   --set the filename of image "image" of me to pDataArray["Image URL"]
end FillInData
I did not mean something like this with "check if the custom property" is correct:
Since I am using mergMK to create the map (on card "map"), I can only test the "mergMKAnnotationCalloutTapped" handler on the simulator. If I just do as you suggest, nothing happens when the "callout" disclosure is tapped (i.e. does not go to card "display"). Using TRY does go to card "display" and "answer the icon of btn "display" pops up with an icon id of the image previously in the btn (from another part of the app).

This is the code on card "display"

Code: Select all

on openCard
   --set the filename of image "display" to the cImageFileName of this card
   set the text of field "credit" to the cImageDataName of this card
   set the icon of btn "display" to the cImageIconName of this card
   answer the icon of btn "display"
end openCard

on closeCard
   --set the filename of image "display" to empty
   set the icon of btn "display" to empty
   set the text of field "credit" of card "display" to empty
end closeCard
So the answer dialog is EMPTY here?
But the text in field "credit" is correct?
This actually works correctly for both the text in field "credit" and the icon of btn "display". The answer dialog shows the correct image icon number. However, this only works when an image is touched on the data grid, not when the image is touched on the MAP on card "map" that prompts the "mergMKAnnotationCalloutTapped" handler.
This is the code for "Group DataGrid 1" (which works fine)

Code: Select all

on mouseUp
   local gHilitedLine, gImageData, gImageCredit, gImageIcon
     put the dgHilitedLine of group "DataGrid 1" into gHilitedLine
   put the dgDataOfLine[gHilitedLine] of group "DataGrid 1" into tData
   set the cImageDataName of card "display" to tData["credit"]
   set the cImageIconName of card "display" to tData["btn icon"]
   lock screen for visual effect
go to card "display"
unlock screen with visual effect "flip right very fast"   
end mouseUp
Still having a problem getting this to work:

Code: Select all

command mergMKAnnotationCalloutTapped pAnnotationID, gHilitedLine, gImageData
   try
   put the dgDataOfLine[pAnnotationID] of group "DataGrid 1" into tData
   set the cImageIconName of card "display" to tData["btn icon"]
catch e
   answer e
end try

   lock screen for visual effect
   go to card "display"
   unlock screen with visual effect "push left very fast"
end mergMKAnnotationCalloutTapped
I remain hopeful that you or someone can provide some insight! Thanks!

Charlie

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference DataGrid or Data Array?

Post by Klaus » Mon Jul 20, 2020 6:36 pm

iOS and Android are CASE sensitive operating systems!
In your very first script you have a folder named -> Images -> Upper case i
But in the last scipts posted here you use -> images -> lower case i

So please fix this and try again!

Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Re: Reference DataGrid or Data Array?

Post by Bellballer1 » Mon Jul 20, 2020 7:34 pm

iOS and Android are CASE sensitive operating systems!
In your very first script you have a folder named -> Images -> Upper case i
But in the last scipts posted here you use -> images -> lower case i

So please fix this and try again!
After your 1st reply when you suggested this, I changed all the folders to lower case letters. I even switched the name of the file stored on my computer to lower case.

Klaus
Posts: 13878
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Reference DataGrid or Data Array?

Post by Klaus » Mon Jul 20, 2020 7:40 pm

OK, just wanted to be sure!

Sorry, no brilliant idea in the moment...

Bellballer1
Posts: 40
Joined: Sat Oct 24, 2015 5:42 pm

Re: Reference DataGrid or Data Array?

Post by Bellballer1 » Tue Jul 21, 2020 5:16 pm

Hi Klaus,

I was able to resolve the problem with changing objects on the Data Grid. I obviously needed to change the code in the "LayoutControl" in the Behavior Script of the DG that referenced an image object, so thus the error when I changed to a button object. Now that I'm using buttons, I don't need to worry about the issue I was having with "specialFolderPath('"resources")".

Now I just have to solve the issue with getting the mergMKAnnotationCalloutTapped message to insert the proper image and go to the next page.

Thank you for responding to my questions.

Charlie

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”