Newbie: Am lost....

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kpeters
Posts: 112
Joined: Wed Mar 21, 2007 9:32 pm
Location: Kelowna, BC, Canada

Newbie: Am lost....

Post by kpeters » Fri May 04, 2007 1:05 am

Here's what I am trying to do:

Code: Select all

on openStack
  put empty into field "field_Username" 
end openStack
Needles to say that there IS a field by that name - no errors upon syntax check during save, but at runtime i receive:

Type Chunk: no such object
Object stack_Login
Line put empty into field "field_Username"
Hint field_Username

Any ideas?

TIA,
Kai

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Fri May 04, 2007 3:53 am

Object existence is not checked when applying scripts, as they can be deleted, renamed, etc. during execution.

Make sure your field exists, and that it is on the first card of your stack. A stack always opens with the first card shown.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

kpeters
Posts: 112
Joined: Wed Mar 21, 2007 9:32 pm
Location: Kelowna, BC, Canada

Post by kpeters » Fri May 04, 2007 4:50 am

Wish it was that easy....

Here's what happens:

I have a login stack (1 card only which contains the field "field_Username" in question).

Upon successful login it calls a second stack which also contains a single card.

When a button on this card is pressed (which results in calling yet another stack with 4 cards), the error I described happens - after I have long left the first stack.

So how can it complain about something in the first stack's preOpenStack upon leaving the second stack???? BTW, I do a "close this stack" before I go to the scond stack....

Thanks for any pointers,
Kai

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Fri May 04, 2007 7:24 am

Hi Kai,

is the second stack a substack of the first?

I think what you see is the beauty of the messagepath (no kidding, but it needs some getting used to)

in the script of the login stack add:

on openStack
if the owner of the target is not me then pass openStack
put empty into field "field_Username"
end openStack

A recommended read is Richards excellent article on how messages work in Rev found here:

http://www.fourthworld.com/embassy/arti ... _path.html

I also have some of the basic stuff in my free ebook:

http://www.derbrill.de/developers.php

Hope that helps,

Malte

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri May 04, 2007 8:32 am

Kai,

You are using substacks, aren't you? Indeed, the message path gets in the way here.

You can easily solve this problem by moving the openStack and preOpenStack handlers of your mainstack to the script of the first card of your mainstack. This way, the scripts don't run when you open a substack, because the script of the first card of the mainstack is not in the message path that is followed by a message sent by a button of a substack.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

kpeters
Posts: 112
Joined: Wed Mar 21, 2007 9:32 pm
Location: Kelowna, BC, Canada

Post by kpeters » Fri May 04, 2007 6:59 pm

Thanks so much to both of you - all makes good sense now!

Kai

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”