[comp.sys.mac.hypercard] Same-background NEXT/PREV buttons

inde5py@jetson.uh.edu (02/27/91)

Wanted:

I need help writing a script for NEXT and PREVIOUS buttons in a stack with
several backgrounds in no particular order.  I need the buttons to go to the
next or previous card with the same background, with wrap-around from first to
last and vice versa.  The buttons are obviously background buttons.  Also, is
there a way to disable users from using command- 1,2,3,4 to navigate through
the stack?  Thanks for the help!

(Matthew Mucker  INDE5PY@JETSON.UH.EDU)

jonhiga@pucc.princeton.edu (03/01/91)

In article <8647.27cab58f@jetson.uh.edu> inde5py@jetson.uh.edu writes:
>Wanted:
>
>I need help writing a script for NEXT and PREVIOUS buttons in a stack with
>several backgrounds in no particular order.  I need the buttons to go to the
>next or previous card with the same background, with wrap-around from first to
>last and vice versa.  The buttons are obviously background buttons.  Also, is
>there a way to disable users from using command- 1,2,3,4 to navigate through
>the stack?  Thanks for the help!
>
>(Matthew Mucker  INDE5PY@JETSON.UH.EDU)
>
Try the following handler in your stack script:

on domenu choice
  if choice is "next" then
    go to next card of this bg
  else if choice is "prev" then
    go to prev card of this bg
  else if choice is not "first" and choice is not "last" then
    pass domenu
  end if
end domenu

Then for your NEXT button script, you can use

on mouseUp
  domenu next
end mouseUp

and an equivalent handler for the PREVIOUS button.
This will disable CMD-1 and CMD-4, and it will make CMD-2 and CMD-3 work
exactly like the buttons.

-- jonhiga@pucc.princeton.edu

al@magimi.meta.com (Al Egan) (03/01/91)

In article <8647.27cab58f@jetson.uh.edu>, inde5py@jetson.uh.edu writes:
> 
> Wanted:
> 
> ...I need the buttons to go to the next or previous card with the same bg...
on mouseUp
  go next cd in this bg
end mouseUp
> ...Also, is there a way to disable users from using command- 1,2,3,4...
on doMenu x
  if x = "First" or x = "Last" or x = "Next" or x = "Prev" then
    answer "Please use the buttons"
    -- the back door, you must hold cmd & option while clicking OK
    if the commandKey = down and the optionKey = down then pass doMenu
  else pass doMenu
end doMenu
This script can be placed in the card, background, stack, or home stack script,
depending on how global you would like the constraint to be.

__
	Alan Egan				Egan Systems
	Grosse Pointe Shores	Metalogic S.a r.l.
	Michigan, U.S.A.