[comp.sys.mac.hypercard] Query: Card Buttons vs Background Buttons

aperez@caribe.prime.com (Arturo Perez x6739) (07/25/90)

I've put together this stack for personal use and I keep running into this
problem with background buttons.

If you put a background radio or checkbox button on a card then when you
make a new card, it appears on the new card.  But if you hilite the button
then ALL the radio buttons in the stack get hilighted.

If you turn it into a card button, then it doesn't get copied automatically.

So, what am I missing here?

Arturo Perez
ComputerVision, a division of Prime
aperez@cvbnet.prime.com
Too much information, like a bullet through my brain -- The Police

man@eilat.cs.brown.edu (Mark H. Nodine) (07/25/90)

In article <685@cvbnetPrime.COM>, aperez@caribe.prime.com (Arturo Perez
x6739) writes:
|>I've put together this stack for personal use and I keep running into this
|>problem with background buttons.
|>
|>If you put a background radio or checkbox button on a card then when you
|>make a new card, it appears on the new card.  But if you hilite the button
|>then ALL the radio buttons in the stack get hilighted.
|>
|>If you turn it into a card button, then it doesn't get copied automatically.
|>
|>So, what am I missing here?

Sounds like you're not missing anything.  That's the way it works.  On
the other hand, you probably want to keep a different highlight state
for each card in the stack.  To do this, you need to create a background
field, say "state", which you hide.  A background field, unlike a
button, has a different contents on each card in the background.  Then
what you need to do is put the following into your background script
(I'm illustrating this for a checkbox for simplicity instead of a radio
button group):

  on openCard
    set the hilite of bg btn "Button" to bg fld "state"
  end openCard

and in the button's script
               
  on mouseUp
    set the hilite of me to not the hilite of me
    put the hilite of me into bg fld "state"
  end mouseUp

That way, when you go to a new card, the button's state will be
automatically set to what it was the last time.  (You may have some
initialization problems when you create new cards, but these are easily
dealt with.)

	--Mark

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (07/25/90)

In article <685@cvbnetPrime.COM> aperez@caribe.prime.com
(Arturo Perez x6739) writes:
>If you put a background radio or checkbox button on a card then when you
>make a new card, it appears on the new card.  But if you hilite the button
>then ALL the radio buttons in the stack get hilighted.

Yup. In HyperCard 1.x, the hilite state of buttons is constant across
all instantiations of that button, so background radio and checkbox
buttons show the behavior you describe.

This problem can be worked around by placing the button state in a hidden
background field, and using an openCard handler to set the buttons correctly
for that card. Some people have also used a font containing checkbox and
radio symbols, placing these in a field, instead of using buttons.

HyperCard 2.0 will allow you to set a property than makes the hilite
states card-specific.
-- 
========= jeanne a. e. devoto ========================================
 jdevoto@apple.com     |  You may not distribute this article under a
 jdevoto@well.sf.ca.us |  compilation copyright without my permission.
______________________________________________________________________
 Apple Computer and I are not authorized      |        CI$: 72411,165
 to speak for each other.                     |

RP1VOPER@MIAMIU.BITNET (Rob Pickering) (07/26/90)

Date:         Wed, 25 Jul 90 13:27:01 EST
From:         Rob Pickering <RP1VOPER@MIAMIU>
Subject:      Re: Query: Card Buttons vs Background Buttons
To:           aperez@caribe.prime.com
========================================================================
You aren't missing anything.
 
       To my knowledge that's the definition of a background.
When you make an object in the background, it's supposed to be
transfered through the entire stack.  However, card objects are for
that card only.
 
       My problem is a little different.
 
I would like to have a button point to a card, however, that card
cannot be reached sequentially by my background arrows on the bottom
of the card.
 
            Help appreciated, hope my help helped.
 
                                 -Rob