change in one card reflects in another card in same page

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
anil008
Posts: 3
Joined: Mon Dec 17, 2012 2:39 pm

change in one card reflects in another card in same page

Post by anil008 » Mon Dec 17, 2012 2:57 pm

Hi All,

My requirement is for example in one table two table columns are there . one table column is 30% and another one is 70% .

In first table column i have 4 tr so when i click on 1st row it will reflect in another table column data .

Some kind of frames concept like if we change in one frame it will reflect in another frame in same window.

I am very new to live code. Could you please help me how to resolve this using cards in main stack or else is there any way to resolve.

Thanks & Regards,
Anil kumar

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: change in one card reflects in another card in same page

Post by Simon » Mon Dec 17, 2012 8:34 pm

Hi Anil,
I think you may be thinking too much like coding in HTML, LiveCode has way better ways of doing what you are looking for.
You could just use 2 fields with your "links" on the left and your content on the right. Heck if there are only 4 links just use buttons.
As you are new to this forum, people tend to point you toward learning:
http://lessons.runrev.com/
Do a few of those and you'll soon grasp the concepts.

Welcome to the forum.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

anil008
Posts: 3
Joined: Mon Dec 17, 2012 2:39 pm

Re: change in one card reflects in another card in same page

Post by anil008 » Tue Dec 18, 2012 5:49 am

Hi Simon,

Thank you Simon for the reply . Could you please tell me which scenario in that live code tutorials suits my requirement .

Mean while i go through the lessons.

Thanks & Regards,
Anil kumar.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: change in one card reflects in another card in same page

Post by jacque » Tue Dec 18, 2012 7:24 pm

Create two fields the sizes you want. Make the lefthand field a list field. Put the list into it.

Put a script into it that responds to a user click. You can use a mouseUp handler something like this:

Code: Select all

on mouseUp
 put the clicktext into tTopic
 switch tTopic
  case "line 1"
    put "This is line 1" into field 2
    break
  case "line 2"
   put "This is line 2" into field 2
   break
  case "line 3"
   put "This is line 3" into field 2
   break
  case "line 4"
   put "This is line 4" into field 2
   break
 end switch
end mouseUp
That won't work by itself, you need to replace "line 1" with the contents of the first line of field 1, and so forth. Then you also need to replace "This is line 1" with the content that you want to appear in the second field.

There are many ways to store the content you want to show in field 2. You can use custom properties, you can write a script that returns the text, you can read the content from a database or a file, or many other things. But this should get you started. See "clicktext" in the dictionary if you want to know what it does. If your field is a list field the clicktext will give you the content of the entire line rather than just the word under the mouse.

Don't worry about resizing for now, just get the scripts to work. Later if you want the fields to change size when the user resizes the stack, you can write scripts for that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

anil008
Posts: 3
Joined: Mon Dec 17, 2012 2:39 pm

Re: change in one card reflects in another card in same page

Post by anil008 » Wed Dec 19, 2012 11:51 am

Hi Jacque,

what a man you are , its working .

Thank you so much yar.

Can you please tell me how to dispaly entire group (or) 1 card content to be displayed in that second field.

And can we do using tabs like tabs should be in one field like column wise not row wise tabs and i change this tab the content should be reflected in second field.


Thanks & Regards,
Anil kumar.

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: change in one card reflects in another card in same page

Post by dave_probertGA6e24 » Wed Dec 19, 2012 12:45 pm

Hi Anil,

Jacque is actually a Lady - Jacqueline. Just for your info. ;)

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: change in one card reflects in another card in same page

Post by jacque » Wed Dec 19, 2012 6:02 pm

Yes, you can do all that. If you want tabs then don't use fields. Use a tab button and instead of getting the clicktext, use a menupick handler. That will tell you the name of the tab that was clicked.

Set up each group the way you want it to look. When a menu selection happens, hide all the groups and then show the one you want to display. There are other ways to do it, but this way is probably the easiest when you are starting out.

Code: Select all

on menupick pText -- pText will be the name of the tab
  repeat for each item i in "tab 1,tab2,tab3"
   hide grp i
  end repeat
 switch pText
   case "tab 1"
     show group "tab 1 group"
     break
  case "tab 2"
    etc...
 end switch
end menupick
If you name the groups the same as the tabs then you don't need a switch construct, you can do it in a few lines:

Code: Select all

on menupick ptext
  repeat for each item i in "tab 1,tab2,tab3"
   hide grp i
  end repeat
  show grp pText
end menupick
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply