Link to cloned card
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Link to cloned card
From this 'master' card, I have a button 'Clone' with
on mouseUp pButtonNumber
clone card id "1094"
end mouseUp
on the cloned card, the user gives the card a name, 'Project Title' . On returnInField, the name is sent to a scrolling list field on a separate navigation card.
Code attached to the "Project Title" field:
on returnInField
set the textStyle of field "Title" to link
put return before line 1 of field "Index" of card id 1130 //card 1130 contains the scrolling list
put field "Title" before field "Index" of card id 1130
end returnInField
The scrolling list field populates with the various "Project Title" fields just fine but none of them link back to the card with its unique title.
How do I code a URL to return to the card with its unique Project Title?
The underlying purpose of Al is to allow wealth to access skill
while removing from the skilled the ability to access wealth.
while removing from the skilled the ability to access wealth.
-
- Livecode Opensource Backer
- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Re: Link to cloned card
I don't know why you want a URL . . . is this stack going to turn the cloned card into a web page?How do I code a URL to return to the card with its unique Project Title?
Possibly what you want is a button on the front card of the stack
that will send you to the cloned "card with its unique Project Title".
I'm just running round the corner to the vet's as our cat needs her annual immunisation injection.
Then I'll have a 'bash' at that idea.

How?on the cloned card, the user gives the card a name, 'Project Title'
Re: Link to cloned card
Cats $$$$$ been there, done that.
By URL I simply meant a link to the card .. the Project Title is simply a text field where the use gives the card a unique identifier for reference in eg. navigation .. let's suppose the title is "My Poem", or "The Owl and the Pussycat". It's my intention that each card is a self-contained workspace for manipulating text and importing a sound file of eg. the completed work. The primary objective is to provide text tools for playing with the text in various ways. In the Screenshot, I achieve that by using 'selectedText of Me'.
By URL I simply meant a link to the card .. the Project Title is simply a text field where the use gives the card a unique identifier for reference in eg. navigation .. let's suppose the title is "My Poem", or "The Owl and the Pussycat". It's my intention that each card is a self-contained workspace for manipulating text and importing a sound file of eg. the completed work. The primary objective is to provide text tools for playing with the text in various ways. In the Screenshot, I achieve that by using 'selectedText of Me'.
The underlying purpose of Al is to allow wealth to access skill
while removing from the skilled the ability to access wealth.
while removing from the skilled the ability to access wealth.
-
- Livecode Opensource Backer
- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Re: Link to cloned card
So what you are looking for is something like this:
A button containing this:
Here's something to play with:
This clones a card, clones a button on the frontmost card,
names the new card, names the new button the same thing as the new card,
and generally does what you are looking for.
Download the stack: tear it to pieces, and have some fun.
A button containing this:
Code: Select all
on MouseUp
go to card "LatestThing"
end mouseUp
Code: Select all
on mouseUp
ask "What should your card be called?"
put it into IMENA
if IMENA is not empty then
clone btn "Cheese"
set the name of it to IMENA
put the script of btn "Cheese" into SKRIPT
replace "Cheese" with IMENA in SKRIPT
set the script of btn IMENA to SKRIPT
clone card id 1004
set the name of it to IMENA
end if
end mouseUp
names the new card, names the new button the same thing as the new card,
and generally does what you are looking for.
Download the stack: tear it to pieces, and have some fun.

- Attachments
-
- Clone Wars.livecode.zip
- Here's the stack.
- (7.66 KiB) Downloaded 264 times
Re: Link to cloned card
I think the OP is looking for a list field that links to a card of the same name as the clicktext. No buttons involved. I'm not at my computer but the idea is this:
Set the style of the index field to list using its property inspector. In the index field put a mouseUp handler that gets the clicktext. Assuming that's the name of a card, you can then go there.
When a field is set up as a list field, the clicktext will retrieve the entire line which makes text retrieval easier for this sort of thing. Maybe someone else can provide a more detailed handler than I can manage typing on my phone.
Set the style of the index field to list using its property inspector. In the index field put a mouseUp handler that gets the clicktext. Assuming that's the name of a card, you can then go there.
When a field is set up as a list field, the clicktext will retrieve the entire line which makes text retrieval easier for this sort of thing. Maybe someone else can provide a more detailed handler than I can manage typing on my phone.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Re: Link to cloned card
Indeed: but I'm not going to do all the heavy lifting.I think the OP is looking for a list field

Re: Link to cloned card
Hi dalkin,
is that what Jaques wrote what you are after? OK, then do this:
1. To understand LC better you should go to the -> LC Preferences -> General
and check -> Property labels are: Name of Livecode property
The inspector will now show the NAME of the LC property and not the description of that property.
This way you can see what you can use in your scripts!
2. Get used to also NAME all of your cards! You will admit that:
card "index"
is a BIT better to memorize than:
card ID 4711
3. You can "concatenate" strings (text) and then use it "en bloc" like this:
4. Now add this "mouseup" handler to your LIST field -> index
Best
Klaus
is that what Jaques wrote what you are after? OK, then do this:
1. To understand LC better you should go to the -> LC Preferences -> General
and check -> Property labels are: Name of Livecode property
The inspector will now show the NAME of the LC property and not the description of that property.
This way you can see what you can use in your scripts!
2. Get used to also NAME all of your cards! You will admit that:
card "index"
is a BIT better to memorize than:
card ID 4711

3. You can "concatenate" strings (text) and then use it "en bloc" like this:
Code: Select all
on returnInField
## Once you have set this property for the field in the inspector,
## there is no need to do this every time you access the field!
## set the textStyle of field "Title" to link
## put return before line 1 of field "Index" of card id 1130 //card 1130 contains the scrolling list
## This does what you want:
put field "Title" & CR before field "Index" of card id 1130
end returnInField
Code: Select all
on mouseup
## put the complete selected line into a variable
put the selectedtext of me into tCard
## ALWAYS do checks like this, you are now the programmer and repsonsible for EVERYTHING
## Especially if the USER fucks up, it is all YOUR fault! :-D
if there is a card tCard then
## There is a card with that name, so we simply go to that card.
go cd tCard
end if
end mouseup
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10045
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Link to cloned card
The current card is always addressable as "this card", and only one card can be viewed at a a time.
Given that, a set of scripts at the stack level should operations on anything within a given card without variance, no matter which card is being shown at a time.
If you need to access things from other cards while on a given card, the best way to do that will depend on what is being done. But there, as with most objects, giving cards meaningful names that uniquely identify them will make such things simple.
Given that, a set of scripts at the stack level should operations on anything within a given card without variance, no matter which card is being shown at a time.
If you need to access things from other cards while on a given card, the best way to do that will depend on what is being done. But there, as with most objects, giving cards meaningful names that uniquely identify them will make such things simple.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Link to cloned card
Thank you to everyone who contributed to this reply. Much appreciated. In the end, I adapted the workflow described by Klaus (renaming the cards as advised), with the simple addition as follows:
on returnInField
set the name of this card to field "Title" \\ else the call to tCard from the scrolling list field has nothing to work with
put the name of this card into tCard
put return before line 1 of field "Index" of card "Navigation"
put field "Title" before field "Index" of card "Navigation"
end returnInField
I can only think that this will be incredibly useful in many situations to many developers. It's so simple but it's terrific functionality.
on returnInField
set the name of this card to field "Title" \\ else the call to tCard from the scrolling list field has nothing to work with

put the name of this card into tCard
put return before line 1 of field "Index" of card "Navigation"
put field "Title" before field "Index" of card "Navigation"
end returnInField
I can only think that this will be incredibly useful in many situations to many developers. It's so simple but it's terrific functionality.
The underlying purpose of Al is to allow wealth to access skill
while removing from the skilled the ability to access wealth.
while removing from the skilled the ability to access wealth.
-
- Livecode Opensource Backer
- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Re: Link to cloned card
That should be written in great, big letters on the front page of LiveCode's website.It's so simple but it's terrific functionality.
