Want top pass values from one card to another

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
monikadhingra
Posts: 19
Joined: Fri Dec 13, 2013 6:15 am

Want top pass values from one card to another

Post by monikadhingra » Thu Jan 23, 2014 6:55 am

Hi,
I want to pass values from one card to another ,both card are under same stack.
in my first card i am taking line number and according to that fetching value,value is a html,plz chi below
In my first card :
put "item_" & word 2 of the selectedLine of me into theLine
put the customproperties[theLine] of this stack into theItem


Now i want to use this fetched value in my next card but unable to do by using global variable.

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: WANT TO PASS VALUES FROM ONE CARD TO ANOTHER

Post by endernafi » Thu Jan 23, 2014 7:08 am

Monika hi,

There are many ways to do this, using a global is the least preferable one.
I'll write two of them on top of my head.
1.
Use a custom property.
Script for card 1:

Code: Select all

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   set the cPassingParam of card 2 to theItem
end fetchData
Script for card 2:

Code: Select all

on doThing
   put the cPassingParam of me into tParam
   if tParam is not empty then...
end doThing
2.
Using getter - setter method.
Script for card 1:

Code: Select all

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   send "writeParams theItem" to card 2 in 1 milliseconds
end fetchData
Script for card 2:

Code: Select all

local sPassingParam

on writeParams tParam
   put tParam into sPassingParam
end writeParams

on doThing
   if sPassingParam is not empty then...
end doThing
Edit:
Btw, if you still wanna use global variables, you should know that you have to define them in each script where you want to use them.
Script for card 1:

Code: Select all

global gPassingParam

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   put theItem into gPassingParam
end fetchData
Script for card 2:

Code: Select all

global gPassingParam

on doThing
   if gPassingParam is not empty then...
end doThing
Hope it helps...

Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

monikadhingra
Posts: 19
Joined: Fri Dec 13, 2013 6:15 am

Re: WANT TO PASS VALUES FROM ONE CARD TO ANOTHER

Post by monikadhingra » Thu Jan 23, 2014 7:28 am

thanks 1st method working fine.

monikadhingra
Posts: 19
Joined: Fri Dec 13, 2013 6:15 am

Re: Want top pass values from one card to another

Post by monikadhingra » Fri Jan 24, 2014 8:24 am

Hi Ender are you abel to help me in order to show image from url on card?

Post Reply

Return to “iOS Deployment”