> send "doSomething" to grp "someGroupedControls" of cd "B"
>
> but I don't think this changes anything.
If I'm understanding you properly, you're on cd "A" of a stack and are trying
to send messages to an object in cd "B" of the same stack? If so, then as
others have pointed out, "this card" is the currently displayed card in the
target stack, which (since you didn't actually *go* to cd "B") is cd "A".
If your intention is to initialize cd "B" from cd "A" before anyone sees cd
"B", then Mark's first suggestion (set custom properties on cd "B" and then in
the preOpenCard of cd "B" you can evaluate those properties and act on them
before the user sees anything) is the way to go because you could use a
behavior that's attached to all cards that has a preOpenCard handler to
initialize that particular card.
For example, suppose you were clearing out fields and planting the insertion
point in preparation for the user to be able to enter data on a card; if you
had two fields ("First Name","Last Name") on card "A" and three fields
("Title","Author","Date") on card "B", you could do this:
1) Make sure that you prepare the two cards ahead of time by setting a custom
property (I'll use "uFields" as the example):
set the uFields of cd "A" to ("First Name" & cr & "Last Name")
set the uFields of cd "B" to ("Title" & cr & "Author" & cr & "Date")
2) Create a behavior button that contains this script:
on preOpenCard
repeat for each line tField in (the uFields of me)
put "" into field tField of me
end repeat
focus fld tField of me
end preOpenCard
3) Attach the behavior to the cards in your stack
This will cause the "me" context to be the current card, but *before* the user
sees anything happening (since it's in preOpenCard).
(SIDE NOTE: The "of me" phrase in the handler above can be replaced by "this
card" or eliminated entirely for the "put" and "focus" lines since the context
has already shifted, so long as you don't introduce any code that would
purposely shift the context away from the card that's getting the preOpenCard
message - personally I like to keep it there even if it's unnecessary because
of clarity.)
HTH,
Ken Ray
Sons of Thunder Software, Inc.
Email: [email protected]
Web Site: http://www.sonsothunder.com/
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode