[comp.sys.mac] Need Help with a HyperCard function

jlc@atux01.UUCP (J. Collymore) (02/04/88)

I'm having some trouble writing a HyperCard button script and hoping some of
you might have some suggestions.

Problem 1)  I'm trying to install a break into a button script that has to do
	    lengthy calcualtions by scanning certain fields, in numerous cards,
	    in a number of stacks.  I want the user to be able to click on the
	    mouse at ANY time during the run and get a dialog box that will
	    offer the option of continuing or stopping the calculations so that
	    they can go back to fiddling with the stack.

I've tried using "repeat until the mouseClick
			if mouseClick is true
			then answer "Stop Calculations?" with "Yes" or "No"
			end if
		end repeat"
all over the script, and nothing seems to work quite right.  The best that I've
gotten is to have the program stop only after it's gotten a NO and finished
doing another lengthy repeat loop that it was in the middle of!

Problem 2)	The length of time it takes to go find the appropriate cards
		in the other stacks, find the appropriate field and line on
		the card, and begin calculations is slow, even though there
		are only a few cards (many stacks right now with only one card)
		in the stack.  I've tried using "lockScreen" to save time so
		that time isn't wasted redrawing the screen as you watch each
		card being counted, however, is there someway I can make this
		run faster?  Is there a way to have the processing done in the
		background so that the user cvan go about using HyperCard while
		waiting for all the calculations to finish?

If you have any suggestions please send me e-mail or post.  I'd really
appreciate any suggestions, or ideas.


Thanks a lot.

						Jim Collymore

twakeman@hpcea.CE.HP.COM (Teriann Wakeman) (02/11/88)

command-period will stop any script dead in its tracks. Assuming that
you are using a lockscreen true during your calculations, you can add
a press command-period to abort calculations message to your locked screen.
If you need a special message to occur after a calc abort, you can put it
into a hidden field. Have your calc script create a flag (such as putting
a 1 into a hidden field but NOT into a local variable) when starting its
calculations and reset it to 0 when finishing its calculations. You then
can add a script that would show the calc abort message on the next
event, ie mouse down, mouse within, idle or whatever AND a flag. Just
make sure that the scrip passes the event that will, with the flag, show
your abort message.

Hope this helps,

TeriAnn Wakeman