Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcsun!unido!gmdzi!roh From: roh@gmdzi.UUCP (Peter Rohleder ) Newsgroups: comp.sys.mac.hypercard Subject: Problem running script with locked screen Keywords: screen locked bug scroll field style Message-ID: <1649@gmdzi.UUCP> Date: 31 Oct 89 10:09:28 GMT Organization: GMD, Sankt Augustin, F. R. Germany Lines: 102 I thought about writing a background script which automatically sets the style of the field which probably contains a large chunk of text to the necessary style. (By the way: I'm working with HyperCard 1.2.2) Theat means: If the chunk of text exceeds the size of the rectangle of the field the style should be set to scrolling - otherwise the style of the field should be set to rectangle. My thought was to position the text selection behind the text, then to look if the scroll of the field is unequal zero. If it is unequal zero, the text has a size that makes scrolling necessary, otherwise I decrease the size of the rectangle of the bkgnd field until the scroll is unequal zero. Then I set the rectangle to the last value which it had before the scroll changed to non-zero. This script should always get executed on "openCard". It works fine so long as you don't decide to run it with the screen locked. When I lock the screen it seems that the value of the scroll doesn't get updated correctly and HyperCard runs into a never ending loop. In all HyperCard(HyperTalk)-Manuals which I have access to, you can read that all scripts should run as good or even better with locked screen if you decide that locking the screen seems more senseful for the user. Or are there any exceptions ? What do you think ? Or do you have a XCMD which probably can help me to solve the problem of changing the field style corresponding to the size of text it contains ? If you want, you can try it: on openCard --- lock screen --- try to run the script with locked or unlocked screen set cursor to watch select after last word of field WhichContainsText put the scroll of bkgnd field WhichContainsText into SCR if SCR = 0 then get the rectangle of bkgnd field WhichContainsText put it into theR repeat until SCR <> 0 put last item of theR into low put low into prevVal get the rectangle of bkgnd field WhichContainsText put it into theR subtract 5 from low put low into last item of theR set the rectangle of bkgnd field WhichContainsText to theR select after last word of field WhichContainsText put the scroll of bkgnd field WhichContainsText into SCR end repeat get the rectangle of bkgnd field WhichContainsText put it into theR put prevVal into last item of theR set the rectangle of bkgnd field WhichContainsText to theR set the scroll of bkgnd field WhichContainsText to 0 set style of bkgnd field WhichContainsText to rectangle else set style of bkgnd field WhichContainsText to scrolling end if select before text of bkgnd field WhichContainsText if style of bkgnd field WhichContainsText = "scrolling" then set the scroll of bkgnd field WhichContainsText to 0 end if --- unlock screen end openCard on closeCard lock screen set style of bkgnd field WhichContainsText to scrolling set the scroll of bkgnd field WhichContainsText to 0 get the rectangle of bkgnd field WhichContainsText put it into theR put 309 into last item of theR --- 309 is the location of the bottom --- if you have a scrolling field --- may also be another calue set the rectangle of bkgnd field WhichContainsText to theR unlock screen end closeCard Peter Rohleder roh@gmdzi.uucp