Hi Scott,
I gather that your first aim is to have the variable cardName loaded with the name of the card you’re currently viewing in stack “Foundation”. I don’t think the lines:
Code: Select all
go to current card of stack "foundation"
put cardName into Here
... does quite what you want, that is, put the name of the currently viewed card into the variable Here. If I could have a stab at a solution for you, try putting:
Code: Select all
global cardName
on openCard
put the short name of this card into cardName
end openCard
... into the stack script of stack “Foundation”. With this in its stack script, every time you go to a different card in the “Foundation” stack, the short name of the card (from your example “one”, “two” and so on) will be “loaded” into the global variable cardName. Now, if you put the following into the script of the button on your console stack:
Code: Select all
global cardName
on mouseUp
go stack "Foundation"
switch cardName
case "one"
if visible of fld "F1" is true
then show fld "F2"
if visible of fld "F1" is false
then show fld "F1"
break
case "two"
if visible of fld "F3" is true
then show fld "F4"
if visible of fld "F3" is false
then show fld "F3"
break
end switch
end mouseUp
...as you see, because we are using the global cardName, we don’t really need to load it into the Here variable- we can just use cardName directly in the switch structure. Note also I didn’t say:
... I know you are thinking in terms of a familiar “if/then” condition- the switch structure simply looks at the variable cardName- in the case when cardName is “one” (i.e. case “one”) flds “F1” and “F2” are referred to, case “two” refers to flds “F3” and “F4” so switch can represent quite complex conditional branching very simply.
Incidentally, I might mention you don’t necessarily have to go to stack “Foundation” (although this might be what you want for your purposes). It’s possible to control what is shown on stack “Foundation” without going to it. In this case you have to tell Rev where the fields are, e.g.:
Code: Select all
global cardName
on mouseUp
switch cardName
case "one"
if visible of fld "F1" of card cardName of stack "Foundation" is true
then show fld "F2" of card cardName of stack "Foundation"
if visible of fld "F1" of card cardName of stack "Foundation" is false
then show fld "F1" of card cardName of stack "Foundation"
break
case "two"
if visible of fld "F3" of card cardName of stack "Foundation" is true
then show fld "F4" of card cardName of stack "Foundation"
if visible of fld "F3" of card cardName of stack "Foundation" is false
then show fld "F3" of card cardName of stack "Foundation"
break
end switch
end mouseUp
... we’ve dropped the “go” command, but instead have given a pretty exact indication of exactly which fields we are referring to. I hope this is in the right direction for you. I have given it a bit of a test, but do ask if you strike any problems. This is perhaps one approach along the lines you require.
Regards,
Michael