[comp.sys.mac.hypercard] Interaction between "loc" and "lockScreen"

ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) (10/31/90)

I discovered an odd bit of HyperCard behaviour while moving
some customizations from my 1.x Home stack to 2.0.

My stack script has a handler called "restoreState", which restores
the position and visibility of the card, tool, pattern and message
windows to my favourite settings when HyperCard starts up. This
information is stored in an extra card in my Home stack.

Part of restoreState used to go like this:

	set lockScreen to true
	set lockMessages to true
	push this card
	go to card "State Settings" of stack "Home"
	set loc of card window to card field 1
	set loc of message window to subPt(the loc of card window, card field 2)
	set loc of tool window to subPt(the loc of card window, card field 3)
	set loc of pattern window to subPt(the loc of card window, card field 4)

(subPt is a HyperTalk function which returns the difference between
two points.)

The thing is, the expression "the loc of card window" in the last
three lines returns the position of the card window *before* the
"set" command in the fifth line!

Replacing "the loc of card window" in those three lines by
"card field 1" makes no difference; the windows are still being
positioned relative to the old card window position, not its new one.

I fixed the problem by getting all the information from the
State Settings card, returning to where I was, unlocking the screen,
and *then* updating all the window settings.

I guess the problem here is one of consistency: "lockScreen" not
only prevents card windows from updating, it also prevents any
changes in their position from being visible. In a situation like
this, should "loc" return the window's last *visible* position,
or the last one "set"?

By the way, this behaviour may have been present in versions 1.x
of HyperCard, but I never noticed it, simply because of the
fixed card size--my card window was always in the same place!

Lawrence D'Oliveiro                       fone: +64-71-562-889
Computer Services Dept                     fax: +64-71-384-066
University of Waikato            electric mail: ldo@waikato.ac.nz
Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
To someone with a hammer and a screwdriver, every problem looks
like a nail with threads.