card id and button problem
Rob Cozens
rcozens at pon.net
Wed Jun 30 11:50:57 EDT 2004
>I tried to use Rob's suggestion, and it ALMOST worked - Being code
>illiterate, I don't pretend to understand the solution, so I just
>applied it word for word, most likely not recognizing something I
>needed to substitute for
Lars,
Sorry, when posting handler statements I use "[" & "]" to enclose
words that must be replaced by an actual argument...a la Rev
Dictionary. Unfortunately the same symbols are used in actual
Transcript to denote an array element.
The solution I attempted to outline is:
1. Store the id of the new button in a local variable when it is created
2. Set a custom property of the new button to the id of the new card
in the drawer stack when the card is created
3. Reference the custom property to identify which drawer card to go
to when the button receives mouseUp.
The reason this solution avoids changing the button script is because
a Revolution standalone cannot modify any stack script that exceeds
scriptLimits() lines (see Rev Dictionary).
The issue I had with
copy btn id xxxx to stack "MainStack"
is Rev Dictionary (Copy) essentially says a control can only be
copied to a group or a card--not to a stack.
So
"copy button id xxxx to card [cardReference] of stack "Main Stack"
was born. cardReference could be the name, number, or id of the card
in "Main Stack" where the new button is created.
> copy btn id 1003 to recent card of stack "MainStack"
I haven't had occasion to use "recent", but the syntax does not
include stack designation. In other words, recent card is the last
card visited in the runtime session, regardless of stack: it's part
of the runtime tables, not a stack-specific property.
So if you can:
copy button id xxxx to card 1 of stack "Main Stack"
or
copy button id xxxx to card id 1234 of stack "Main Stack
or
copy button id xxxx to card "Drawer Buttons" of stack "Main Stack
, I think that will solve the problem.
--
Rob Cozens
CCW, Serendipity Software Company
"And I, which was two fooles, do so grow three;
Who are a little wise, the best fooles bee."
from "The Triple Foole" by John Donne (1572-1631)
More information about the use-livecode
mailing list