-- Get the current value of the cache when the card's opened.
on openCard
send calcCache to card field Cache
end openCard
-- part 1 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=284 top=187 right=204 bottom=319
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: Cache
----- HyperTalk script -----
-- SetCache is a XFCN external function. Given a 0 or 1 parameter
-- it sets the cache on and off. With no parameters it returns
-- the current setting.
- calcCache is sent from the card script on an openCard.
on calcCache
put SetCache( ) into card field Cache
end calcCache
on mouseUp
if card field Cache = "On" then
put "off" into newval
else
put "on" into newval
end if
put SetCache(newval) into card field Cache
end mouseUp
-- part 2 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=10 top=10 right=139 bottom=501
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part 3 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=12 top=243 right=328 bottom=211
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name:
-- part contents for card part 1
----- text -----
On
-- part contents for card part 2
----- text -----
If you're using HyperCard as a minifinder on the Mac II, then you might find this cache control stack useful. To incorporate it in your stack, you need to copy the SetCache XFCN with ResEdit and copy the Cache card field from this stack (the script will come with it).
Have a look at the card script, too. The openCard stuff should be copied over as well. This updates the field when the card is opened.