Page 1 of 1
Display Card ID in a Field
Posted: Mon Sep 20, 2021 4:49 pm
by tlottrike@gmail.com
Hi all
I would like a
Field to display the
Current Card ID in a stack with a number of Cards but I keep creating an error.
I've been trying variations of the following but no luck
Code: Select all
on opencard
get the current card id
put current card id me in Field "FieldCardId"
end opencard
Any suggestions on how I could achieve this?
TIA
Re: Display Card ID in a Field
Posted: Mon Sep 20, 2021 5:03 pm
by Klaus
Hi
tlottrike@gmail.com,
just like native english!
Code: Select all
on opencard
put the ID of this card in Field "FieldCardId"
end opencard
Best
Klaus
Re: Display Card ID in a Field
Posted: Mon Sep 20, 2021 5:16 pm
by tlottrike@gmail.com
Thanks Klaus (apologies Klaus)
That worked but it insisted instead of "In" I used the word "into" plus I found if I put your script at the Stack Level it worked straight away going from one Card to the next whereas having it at the Card Level it worked but only after clicking through the cards.
Thanks again
Re: Display Card ID in a Field
Posted: Mon Sep 20, 2021 5:28 pm
by Klaus
KARL? Come on, you can do better!
tlottrike@gmail.com wrote: ↑Mon Sep 20, 2021 5:16 pm
That worked but it insisted instead of
"In" I used the word
"into"...
Oh, yes, overlooked this one, sorry.
tlottrike@gmail.com wrote: ↑Mon Sep 20, 2021 5:16 pm
... plus I found if I put your script at the Stack Level it worked straight away going from one Card to the next whereas having it at the Card Level it worked but only after clicking through the cards.
Yes, if your cards do not have a "on opencard" handler of their own, the message OPENCARD will be passed and
finally LC finds an appropriate script in the stack script, so this will be executed on every card.
Make sure you have a field "FieldCardId" on every card!
But even it one or more cards have an own OPENCARD handler you can force the OPENCARD handler in the stack script
to be executed too by PASSing the message.
Card script of one of more cards:
Code: Select all
on opencard
## do this
## do thqt
## and that over there, too
## Here it comes:
pass opencard
end opencard
Best
Klaus (
KLAUS, K L A U S!)
Re: Display Card ID in a Field
Posted: Mon Sep 20, 2021 7:50 pm
by dunbarx
Hi.
The beauty of LiveCode is that what you would describe in English is usually very close to a workable way for LC to understand.
Usually, close.
The danger of LiveCode is that what you would describe in English may not work at all. You must still abide by a fairly strict syntax.
Your thinking was basically sound. You just needed to say it correctly. When learning, use the dictionary all the time. You would have discovered that there is no native word "current" in the language. It does appear here and there in other contexts, but not the way you used it. Also, if you had looked up "me" you would have seen examples where me is used, though never quite the way you did.
All details, but all critical. It is just a matter of learning how to speak the language. Fortunately, that is easier than learning how to organize your thinking flow into something logical. You already seem to have that well in hand.
Craig