Page 1 of 1

change in one card reflects in another card in same page

Posted: Mon Dec 17, 2012 2:57 pm
by anil008
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

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

Posted: Mon Dec 17, 2012 8:34 pm
by Simon
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

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

Posted: Tue Dec 18, 2012 5:49 am
by anil008
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.

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

Posted: Tue Dec 18, 2012 7:24 pm
by jacque
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.

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

Posted: Wed Dec 19, 2012 11:51 am
by anil008
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.

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

Posted: Wed Dec 19, 2012 12:45 pm
by dave_probertGA6e24
Hi Anil,

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

Cheers,
Dave

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

Posted: Wed Dec 19, 2012 6:02 pm
by jacque
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