RE: Problem Calling Custom Card Props with the Same Nam Using Switch

2009-11-30 Thread Jim Bufalini
Hi Gregory,

 -Original Message-
 From: use-revolution-boun...@lists.runrev.com [mailto:use-revolution-
 Hello Jacques, Jacqueline, Craig, and Jim,
 
 Sadly, it is a bug then.  The consequences, as I said, are potentially
 serious for any stack that uses custom props with the same name to
 monitor various states of objects.  Jacqueline and Jacques (kind of
 musical, eh?), I experimented a little more and find that it is not
 limited to using y as the variable name or one-letter variable names in
 general.  I get the same problem when x is used for the custom prop on
 two different cards and when a two-letter name, xV, is used.  The
 problem is also there if you use an If control structure rather than
 Switch, and it is not limited to cards.  I set props for two buttons in
 the same way and lost the value of the same-named prop for the second
 button.  I haven't used Behaviours yet, but you can readily see how the
 problem could be pervasive there.
 
 Jim, I appreciate the fix you suggest, but when you say long name, do
 you mean the long name of the card?  If so, then that does not work
 either.  In any case, a bug report is in order.

I gave a very quick answer to you because I do this all the time and, in
fact, ListMagic has identically named custom property sets in the stack(s)
and in each card that you install ListMagic widgets in. If what you say were
true, ListMagic would not work at all.

So I created a stack, added two cards called FirstCard and SecondCard (I
don't like spaces in names) and in cd id 1002 I created a button with the
following script:

ON mouseUp pMouseBtnNo
set the x of cd FirstCard of this stack to 123
set the y of cd FirstCard of this stack to 456
set the y of cd SecondCard of this stack to ABC
set the z of cd SecondCard of this stack to DEF
END mouseUp

I then put a button and a field called fldResult on FirstCard and
SecondCard. The button has this script:

ON mouseUp pMouseBtnNo
local tX, tY, tZ
-   # 
put the short name of this card  cr  the long name of this cd into fld
fldResult 
SWITCH the short name of this card
CASE FirstCard
put the x of (cd  the short name of this card) into tX
put the y of (cd  the short name of this card) into tY
put return  x  tX  y  tY after fld fldResult
break   # 
CASE SecondCard
put the y of (cd  the short name of this card) into tY
put the z of (cd  the short name of this card) into tZ
put return  y  tY  z  tZ after fld fldResult
break
DEFAULT
put cr  Error: It's neither card into fld fldResult
END switch
END mouseUp

On FirstCard I get:

FirstCard
card FirstCard of stack D:/MyStacks/TestCProps.rev
FirstCard
x 123 y 456

And on SecondCard I get:

SecondCard
card SecondCard of stack D:/MyStacks/TestCProps.rev
y ABC z DEF


Seems correct to me. ;-)

There is no problem except readability and maintainability of code in using
1 char custom properties and vars. When you experience weirdness like you
are seeing, first put to a field in your stack rather than the msg box to
eliminate any possibility of the msg box contributing to your issue and then
change excessive use of *this* stack or *this* card to something more
specific. Also use parenthesis to resolve a name like a card name first.

Aloha from Hawaii,

Jim Bufalini


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Problem Calling Custom Card Props with the Same Nam Using Switch

2009-11-30 Thread J. Landman Gay

Jim Bufalini wrote:

Also use parenthesis to resolve a name like a card name first.


I was wondering about this too. In my (successful) tests, I also renamed 
the cards. The word first is a reserved word, and first card is a 
valid card reference, so I was wondering if the engine was getting 
confused about that. A better naming strategy would be to avoid use of 
reserved keywords in card names and then try testing again.


--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution