Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!snorkelwacker!think!zaphod.mps.ohio-state.edu!mips!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: Setting userLevel at openStack time Keywords: openStack HyperCard userLevel Message-ID: <39073@apple.Apple.COM> Date: 28 Feb 90 22:32:04 GMT References: <3026@oakhill.UUCP> Distribution: usa Organization: Apple Computer Inc, Cupertino, CA Lines: 49 In article <3026@oakhill.UUCP> tomj@oakhill.UUCP (Tom Johnson) writes: > [...] I don't want the grungy users munging around >in my pristine scripts, Oh, please. I have yet to see the piece of code that couldn't be improved. A wish to protect naive users is commendable, and a valid reason for hiding scripts; but a reluctance to see one's code sullied by bugfixes and improvements is not. Furthermore, one rule-of-thumb in designing user interfaces is that user-settable preferences (such as the userLevel) should not be changed unless it's required for best functioning of the stack. However: > so I decide to set the userLevel to 2 at openStack >time. I also add a nifty password capability so I can get back to userLevel >5 whenever I want. I also trap all "set" messages, and if the password >check has not been met, and the keyword "userLevel" is in the "set" message, >just beep, otherwise pass the set on. This is an awful lot of trouble to go to. Why not use the Protect Stack item to set the lid userlevel to 2? Much simpler, reasonably foolproof. And it does exactly what your solution does. You also don't have to worry about cleaning up after your stack when the user exits (I assume you *are* saving the previous userLevel and restoring it on closeStack?). >Everything works great EXCEPT the >request to set the userLevel to 2 on openStack! I've tried everything I can >think of: > 1) use a "send 'set UserLevel to 2' to Hypercard" > 2) issue a "set userLevel to 2" after tricking the password checker > 3) every possible variation on the above 2, and in every possible > position of the openStack handler. > >The "set userLevel to 2" works fine, as long as it is NOT in the openStack >handler. What's going on? The problem is that the startup message is sent AFTER openStack, rather than before as one might think. The Home stack's startup handler executes a routine called getHomeInfo, which among other things sets the userLevel to the user's preferred level. This means that any preferences set in a stack's openStack handler are reset to the user's selected preferences immediately if the stack has been opened by double-clicking. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST