Cant Create New Card in a Stack by Script

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
jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 110
Joined: Fri Mar 09, 2007 9:47 pm

Cant Create New Card in a Stack by Script

Post by jsburnett » Sun Aug 27, 2023 6:09 pm

Hi,
I am having creating by a script a new card.
I am trying to creat a new card in a button script.
The button name is "Add" FYI.

The line I am having trouble with is:
create card tNewCardName in stack "Product Data"

The tNewCardName is the name of the new card to be added to stack "Product Data"

This button, "Add" is on/in a different stack.

The Error I am getting is:
button "Add": execution error at line 17 (Chunk: can't find stack), char 1

Any thoughts?
Thanks in advance.
John Burnett

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9754
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cant Create New Card in a Stack by Script

Post by dunbarx » Sun Aug 27, 2023 9:27 pm

John.

There is nothing wrong with your handler. Even so, I made two simple test stacks with the pertinent gadgets to execute the single line of code you posted.
But I see you have more going on in your handler, so the problem lies in there somehow. Step through your code and you will find the culprit.

Craig

jsburnett
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 110
Joined: Fri Mar 09, 2007 9:47 pm

Re: Cant Create New Card in a Stack by Script

Post by jsburnett » Mon Aug 28, 2023 1:32 am

Craig,

Thanks for the reply.
I found the problem.
The name of the stack, when I checked under the property inspector ended with a 'space' 'Product Data '.
That gave the error.
Thank you for your help.
John

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9754
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Cant Create New Card in a Stack by Script

Post by dunbarx » Mon Aug 28, 2023 1:50 am

Ah.

"Invisible" spaces have messed up stuff for me forever. Hard to see, and oftentimes I have simply rewritten certain bits, all the whiie thinking that I never changed a thing, but the problem went away.

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”