[comp.sys.mac.hypercard] Background Button Problems

miles@ms.uky.edu (Stephen D. Grant) (08/16/90)

hi. I am having a little difficulty with some buttons in my stack. They
are all background buttons and they occur on each card in my stack. However,
there are some cards that I want to NOT HAVE the buttons (HIDE them). The
problem is that I have been unable to hide them from one card only. I can
issue a hide command from the message box or scripts, but it hides the 
background button for good, for all cards until it is SHOWED again.

What can I do to get one card to hide a button for it, and then show or turn
on the button when it goes to the next card?? Arf! 

Coffee Time..

Miles

=============================================================================
Stephen D. Grant, "Miles" |  Hell Opened Up and Put on Sale;
miles@s.ms.uky.edu        |  Gather Round and Haggle..  (no coupons)
(President of the new chain stores "UZI's, AR-15's and HK94's R US")
=============================================================================

clarson@ux.acs.umn.edu (Chaz Larson) (08/16/90)

In article <15824@s.ms.uky.edu> miles@ms.uky.edu (Stephen D. Grant) writes:
>hi. I am having a little difficulty with some buttons in my stack. They
>are all background buttons and they occur on each card in my stack. However,
>there are some cards that I want to NOT HAVE the buttons (HIDE them). The
>problem is that I have been unable to hide them from one card only. I can
>issue a hide command from the message box or scripts, but it hides the 
>background button for good, for all cards until it is SHOWED again.
>
>What can I do to get one card to hide a button for it, and then show or turn
>on the button when it goes to the next card?? Arf! 

On the appropriate cards, cover the offending background button with a card
button containing the following script:

on mouseUp
--do nothing
end mouseUp

that will absorb any clicks that might otherwise get to the background button.

You can use card graphics to visually hide the button.

<chaz>



-- 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            "Must think...bubble pipe will relax me and I think..."
                                   - Flaming Carrot      
clarson@ux.acs.umn.edu                                       AOL:Crowbone

tn505981@longs.LANCE.ColoState.EDU (Todd Nathan) (08/17/90)

Okay, I think I might have a generic answer for the question of how to
avoid the noid...
At the card level we write...

	on mouseUp

		put "aButton,anotherButton,someButton" into avoidTheseButtons
		get the short name of the target
		if it is not within avoidTheseButtons then pass mouseUp

	end mouseUp

This might work,  I have not checked it out, but the concept is there. 
This way you can specify at each card which buttons you would like to
avoid.  This could be done also with card buttons.


Sincerely,

Todd
tn505981@longs.LANCE.ColoState.Edu

tn505981@longs.LANCE.ColoState.EDU (Todd Nathan) (08/17/90)

Okay,  I screwed up.  Not unusual.  I was just messing around.  Anyway,
I think that the script should check to see if the target is even a
button in the first place, so here is a new version (which might work also)...

	on mouseUp

		if "Button" is not within the name of the target then pass mouseUP

		put "aButton,anotherButton,someButton" into avoidTheseButtons
		get the short name of the target
		if it is not within avoidTheseButtons then pass mouseUp

	end mouseUp


So please stop the flaming, I was just trying to help all the readers. 
Next time I might not give any public help...

Sincerely,

Todd
tn505981@longs.LANCE.ColoState.Edu

clarson@ux.acs.umn.edu (Chaz Larson) (08/17/90)

Yes, Cameron, that is a much more sensible and elegant solution.  I just gave
the first solution that came to mind, which probably tells you why I'm not
a HyperCard developer... 8)

<chaz>



-- 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            "Must think...bubble pipe will relax me and I think..."
                                   - Flaming Carrot      
clarson@ux.acs.umn.edu                                       AOL:Crowbone

cameron@kirk.nmg.bu.oz (Cameron Stevenson) (08/18/90)

From article <2080@ux.acs.umn.edu>, by clarson@ux.acs.umn.edu (Chaz Larson):
> In article <15824@s.ms.uky.edu> miles@ms.uky.edu (Stephen D. Grant) writes:
>>
>>What can I do to get one card to hide a button for it, and then show or turn
>>on the button when it goes to the next card?? Arf! 
> 
> On the appropriate cards, cover the offending background button with a card
> button containing the following script:
> 
> on mouseUp
> --do nothing
> end mouseUp
> 
> that will absorb any clicks that might otherwise get to the background button.
> 
> You can use card graphics to visually hide the button.
> 
> <chaz>
> 
   Chaz, without sounding rude, this seems like a very clumsy way to hide a 
   few buttons. Sort of bulldozer effect - cover the bloody thing up and it
   might go away....

   What is wrong with:

   on opencard
      hide bg btn BUTTON_NAME
   end opencard

   accompanied with:

   on closecard
      show bg btn BUTTON_NAME
   end closecard

   Those two handlers, placed in the scripts of every card for which Stephen
   wants the bg btns to disappear will work. Alternatively, if there are more
   cards in that background that need the buttons to disappear, than ones that
   don't, then create a new background without the offending buttons (and
   have two backgrounds in your stack - what a concept, eh?)

   Cheers....

   Cameron Stephenson                    Telephone  +61 75 951220
   Bond University
   Gold Coast    Australia

n_hays@vaxa.cc.uwa.oz.au (08/18/90)

In article <15824@s.ms.uky.edu>, miles@ms.uky.edu (Stephen D. Grant) writes:
> hi. I am having a little difficulty with some buttons in my stack. They
> are all background buttons and they occur on each card in my stack. However,
> there are some cards that I want to NOT HAVE the buttons (HIDE them). The
> problem is that I have been unable to hide them from one card only. I can
> issue a hide command from the message box or scripts, but it hides the 
> background button for good, for all cards until it is SHOWED again.
> 
> What can I do to get one card to hide a button for it, and then show or turn
> on the button when it goes to the next card?? Arf! 

Put the following in the CARD script of the card in which you want the button
to be hidden.

on opencard
  hide background button "whatever"
end opencard

on closecard
  show background button "whatever"
end closecard

This advice comes to you free from Australia on the sole condition that you
people stop electing used car salesmen, peanut farmers and senile B grade
movie actors to the White House. Your making the rest of us very nervous!!!
Neale Hays
University of Western Australia

masinter@parc.xerox.com (Larry Masinter) (08/26/90)

It is much more reliable to hide background buttons and fields by
putting something in front of them (a card painting or opaque
iconless, nameless button without script).

Among the advantages over scripting "hide" and "show" commands is the
reduction in screen flashing (the buttons don't temporarily appear on
the screen until the script kicks in) and in disk access (hypercard
normally writes the disk if you change the 'visible' property
of an item.)

--
Larry Masinter (masinter@parc.xerox.com)
Xerox Palo Alto Research Center (PARC)
3333 Coyote Hill Road; Palo Alto, CA USA 94304
Fax: (415) 494-4333

bc@Apple.COM (bill coderre) (08/26/90)

Larry Masinter:
|It is much more reliable to hide background buttons and fields by
|putting something in front of them (a card painting or opaque
|iconless, nameless button without script).
|
|Among the advantages over scripting "hide" and "show" commands is the
|reduction in screen flashing (the buttons don't temporarily appear on
|the screen until the script kicks in) and in disk access (hypercard
|normally writes the disk if you change the 'visible' property
|of an item.)

I'll argue the other way, just for fun.

True Fact: Remember that a bg btn has "x ray eyes" and can see a
mouseclick right thru the cd pict. This means that the only "reliable"
way to cover a bg btn is with a cd btn, since the cd btn will get the
mouseclicks instead. Make sure to test this before shipping.

Now the pedantry:

I have used both methods extensively, and I find it simpler and faster
to hide and show buttons, by writing a function UpdateButtons to show
and hide the appropriate set, based on your "gestalt" variables
("JobRunning," "EditingJob", etc). It's more secure than covering over
stuff, concentrates all the update knowledge into one function, and is
actually quite fast if you lock/unlock the screen. Doing so seems to
cause HC to cue up all the disk work to be done at once, removes
flashing, and provides the opportunity to do a tasteful visual effect.
It also only takes a tiny fraction of a second more than wallpapering,
and allows for you to have arbitrarily many modes on the same card.
You only get one cd pict.

Please remember that despite my posting site, I am ONLY a consultant
to Apple, and therefore my opinions are even more my own than those of
the Apple Employees who post THEIR opinions here.

mr HEINOUS
final and ultimate arbiter of all matters of style and taste