HyperCard: How To Restrict User To Browse While Modifying Stack


If you want to restrict the user of your HyperCard stack to the browse level
while the script is allowed to modify the stack, take note of the following
scripts:

1. This script stores the Home card userLevel in the global variable
"Store_userLevel" and sets the userLevel to 1 (Browsing). When
quitting the stack, you may restore the userLevel to the value in
"Store_userLevel".

on openStack
global Store_userLevel
put the userLevel into Store_userLevel
set the userLevel to 1
end openStack

2. This script shows how to change the userLevel, so modifications can be
made to the stack via HyperTalk commands.

on mouseDown
set the userLevel to 5
-- (Do stack modifying commands here)
set the userLevel to 1
end mouseDown

3. This script shows how to use the "cantmodify" property to prevent a user
from modifying a stack while still allowing the script to do so.

on openStack -- (Put this in the stack script)
set cantModify to true
end openStack

on mouseDown
set cantModify to false
-- (Do stack modifying commands here)
set cantModify to true
end mouseDown


Published Date: Feb 18, 2012