How can I tell if I'm on the first card (of this bg or of this stack)?

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
mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

How can I tell if I'm on the first card (of this bg or of this stack)?

Post by mluka » Tue Jun 19, 2018 3:20 pm

Hi all.

Such simple questions...

Thanks!
Michel
Montréal, Canada

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How can I tell if I'm on the first card (of this bg or of this stack)?

Post by Klaus » Tue Jun 19, 2018 3:45 pm

Bonjour Michel,

et voila:
...
put the number of this cd
...
:-)

Best

Klaus

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

Re: How can I tell if I'm on the first card (of this bg or of this stack)?

Post by mluka » Tue Jun 19, 2018 4:04 pm

Hallo Klaus.

Not really... what I want to be able to do is something like:

if this card is the first card of this stack then...

I've been trying all kinds of combinations in the msg box, but none of them works (errors like "chunk source is not a container, etc.)

Regards.
Michel
Montréal, Canada

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How can I tell if I'm on the first card (of this bg or of this stack)?

Post by Klaus » Tue Jun 19, 2018 4:10 pm

Bonjour Michel,

LC is all about PROPERTIES and to get and set them and cards have a NUMBER property, so:

Code: Select all

...
if the num of this cd = 1 then
  ## current card is the FIRST card in your stack, do your thing...
end if
...
Best

Klaus

mluka
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Sun Jun 17, 2007 12:08 am
Location: Montréal, Canada

Re: How can I tell if I'm on the first card (of this bg or of this stack)?

Post by mluka » Tue Jun 19, 2018 4:24 pm

Ah... the properties!

Thank you for pointing me in that direction!

And I see that I won't have to ask my followup question: how can I tell if I'm on the LAST card:

the number of the last cd of this stack

Danke, danke!
Michel
Montréal, Canada

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: How can I tell if I'm on the first card (of this bg or of this stack)?

Post by Klaus » Tue Jun 19, 2018 4:35 pm

Many ways to skin a cat in Livecode:
...
if the num of this cd = the num of cds then
...
:D

Avec plaisir, mon ami!

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”