Page 1 of 1
Problems with variables, understanding or usage
Posted: Tue Aug 04, 2015 4:06 pm
by tobirobi
Hello LiveCode community,
its the first Time i am posting in this forum. I am an apsolute beginner in using Livecode and I need your help, it looks like that i have some problems in understanding the usage of variables. I hope you can take me by the hand and push me in the right direction. I
I want to build a Android app for receiving push notifications and manage them on the phone.
I want to start with two cards one called "MessageList" and the other one called "PushMessage"
on the MessageList card i have a "DataGrid 1" where i can scroll trough the list of received messages and if i click on a message i whant to "move" to the PushMessage Card and show the content of the Push Notification.
My problem is that i dont know how i can transfer the fields out of the DataGrid to the second card to show them in the PushMessage.
Can you explain for a dummy how to move variables from one card to another.
Thanks for understanding, help and not so many "head shakes".
Tobi
Re: Problems with variables, understanding or usage
Posted: Tue Aug 04, 2015 4:17 pm
by Klaus
Hi Tobi,
1. welcome to the forum!
2. You may not need a variable at all in this case, you can access any object on any card in any stack as long as you address it correctly!
You can do this on card "MessageList" or any other card:
...
## First fill the field on any different card:
put fld "some field with text" into fld "another field" OF CD "PushMessage"
## Done, now go to that card:
go cd "PushMessage"
...
I can recommend these stacks to glearn more about the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Hope that helps!
Best
Klaus
Re: Problems with variables, understanding or usage
Posted: Thu Aug 06, 2015 10:31 am
by tobirobi
Hello Klaus,
sorry but i did not understand you exactly.what i want is to select (and click on) one entry from the existing list in the datagrid and show the contained field entries on the second card.
Thats why i am think that your excample does not fit. Or did i miss something?
Regards,
Tobi
Re: Problems with variables, understanding or usage
Posted: Thu Aug 06, 2015 11:42 am
by Klaus
Hi Tobi,
oh, sorry, looks like I misunderstood you!
OK, datagrids are highly complex beasts, so first a question:
Is your datagrid of type TABLE or FORM?
You should check this webpage and download the Datagrid PDF, since this is the only doc we have for datagrids!
http://lessons.runrev.com/m/datagrid
Read it, work through the examples and read it until you know it by heart!
Nevertheless you will have to read up again with every new project where datagrids are involved!
At least this is the case for me
Best
Klaus
Re: Problems with variables, understanding or usage
Posted: Thu Aug 06, 2015 11:48 am
by tobirobi
Hi Klaus,
oh good that the misunderstanding was on your side

I have of course myself doubted.
The datagrid Style is FORM.
I am actually reading so much in this Livecode lessons that i think i am blind on that eye to find the right way.
Thanks,
Tobi
Re: Problems with variables, understanding or usage
Posted: Thu Aug 06, 2015 12:01 pm
by Klaus
Hi Tobi,
FORM, OK
All data that you "pull out" of a datagrid come in ARRAY format.
You will need to add or modify the "mouseup" handler in the behaviour script of your datagrid.
Code: Select all
...
## First we need to know what KEY we need to extract form the complete datagrid Array:
put the dgindex of me into tIndex
## Now fetch all data associated with this index:
put the dgdataofindex[tIndex] of me into tData
## Now you need to extract all the wanted infos from this data and populate fields on another card:
put tData["whatever"] into fld "whatever" of cd "another cd"
put tData["whatever2"] into fld "whatever2" of cd "another cd"
## Etc...
## No all fields have been populated, we can continue:
go cd "another card"
...
You get the picture!
Best
Klaus
Re: Problems with variables, understanding or usage
Posted: Fri Aug 07, 2015 8:10 am
by tobirobi
Hi Klaus,
my problem is solved, thanks for your support and the push in the right direction.
Wave a nice weekend,
Tobi