Page 1 of 1

Changing variables in of same object in different cards!

Posted: Sat Jun 29, 2013 5:16 pm
by BKhamissi
I am creating a database, I want with a press of a button to create a new card and with the same objects of the previous card, so I made them in groups and checked the " behave as background " check box! To be displayed in the new card. The problem is I am using a data grid, I want the same data grid, with the same column titles in the new card, so I can add data to the data grid without changing the data in the data grid of the previous card.

I am entering the data from the data grid by using input text fields.

The second problem, I want to change the Label field I am using as a title of the database, by letting the user to input the new title, but I don't want it to change the title of the previous card, although I am using the same Label Field?

What should I do? Is it possible to do such thing?

I am a beginner in live code, and will really need some help.

Re: Changing variables in of same object in different cards!

Posted: Tue Jul 02, 2013 12:24 pm
by LCNeil
Dear BKhamissi.

Thank you for your request.

I have moved your questions to a forum where I believe you will receive more assistance from the LiveCode community.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-

Re: Changing variables in of same object in different cards!

Posted: Tue Jul 02, 2013 3:20 pm
by dunbarx
Hi.

This is interesting in that a new datagrid, which is already a group, does not seem to follow the backGroundBehavior in the same way that fields do. You can set this property manually (it is not an inspector option), but it does not automatically work the same way fields do. I could be wrong, but it looks like you have to refresh the datagrid each time you create a new card, or navigate to a card with this group already on it. Fortunately, all this is easily done, as column names and the dg contents are all properties that can be set. I will play around a bit more, and I am sure others with more DG experience will chime in.

As an experiment, make a new mainstack. Put a datagrid and a field on the first card. Set the sharedText of the field to "true". Set the name of the datagrid to "dg1". Group the datagrid and the field, and set the backGroundBehavior of the new group to true. Put some data into the field.

Put this into the stack script:

Code: Select all

on opencard
   set the dgText of grp "dg1" to the number of this card & tab & the number of this cd + 2
end opencard
Make a new card. The field will hold its data, but not the DG, including its column names. Comment out the handler. Nothing holds.

Craig Newman