[comp.sys.mac.hypercard] how to make arbitrary-shaped buttons?

rls@laidbak.UUCP (Richard Scott) (08/12/89)

	I'm wondering how I can produce arbitrarily-shaped buttons in
Hypercard, such that I could do, for example, a map of an area, where
within the boundaries of each sub-region, I could do a button action.
Unfortunately, variations of rectangles just doesn't suffice. Can I
*draw* a custom button area, using the drawing tools? None of the HyperCard
books I have say this.

	Also, does HyperCard do some sort of caching of it's state, and then
do occasional buffer flushes (e.g. like UNIX's "sync")? I notice when I'm 
working on my Sun, I can hear my Mac hard-drive do an access once every few
minutes or so, but only when HyperCard is running on it (quiescently - on
the Home card). Just curious.

        rich scott                              {sun,att}!laidbak!rls
        interactive systems corporation         voice: (800) LAI-UNIX x255
        naperville, il, usa
----------------
"Addison, what are we going to do?" "Me, I'm examining the major Western
religions.  I'm looking for something that's soft on morality, generous with
holidays, and has a short initiation period." [Dave and Maddie on Moonlighting]

sean@eleazar.dartmouth.edu (Sean P. Nolan) (08/14/89)

Hypercard can't do arbitrarily-shaped buttons. However, there is a new
Hypercard clone by Olduvi called "Plus" that allows you to sort-of do it.
You draw a normal rectangular button over the area and then assign the parts
of it you want to be "active" a particular color. Interesting idea, but I
wasn't very impressed with the overall package (it did have some nice extras,
but didn't have the solid foundation that Hypercard does -- kind of like they
were far more concerned with doing what Hypercard COULDN'T do than with making
at as good in the first place). 

A possible Hypercard solution is like the "Dog-Ear" buttons, so long as the
button isn't too complicated (a map would probably be too complicated). You
can get the MouseLoc and determine which pixel IN the button has been clicked,
and limit it that way. That really is only practical for doing triangular
or other regularly-shaped odd buttons.

                                             --- Sean

+----------------------------------------------------------------------------+
| Sean P. Nolan     |                                   |  "Let's face it:   |
| Dartmouth College | Net: Sean_Nolan@Mac.Dartmouth.EDU |   IBM is no fun."  |
| Hinman Box 2658   | MCI Mail: snolan                  |     ::::::::::     |
| Hanover, NH 03755 |                                   |   John C. Dvorak   |
+----------------------------------------------------------------------------+

taylorj@yvax.byu.edu (08/14/89)

Get the Waite Group's "Tricks of the HyperTalk Masters" from Hayden Books.
There's a chapter in there on making "polybuttons" that is exactly what you
need.  It's a complicated but beautiful solution.

Alternately, get SuperCard.  It supports polygon buttons directly.


Jim Taylor
Microcomputer Support for Curriculum   |
Brigham Young University               |   Bitnet: taylorj@byuvax.bitnet
101 HRCB, Provo, UT  84602             |   Internet: taylorj@yvax.byu.edu

andy@gistdev.UUCP (Andy Warinner) (08/14/89)

I ran across a chapter in "Tricks of the HyperTalk Masters" that
shows how to do nonrectangular buttons.  The complete information
on the book:

"The Waite Group's Tricks of the HyperTalk Masters"
Hayden Books
ISBN 0-672-48431
list price:  $24.95

I got my copy from TechAlliance which gave me a break on the 
list price.  I haven't read the whole thing yet, but so far I have
found many useful tricks and scripts that make it worth $24.95.

Andrew Warinner    | "Semper ubi sub ubi" - J. Caesar
GIST, Inc.         | ARPANET: andy%gistdev@uxc.cso.uiuc.edu
Standard           | UUCP   : {uunet,pur-ee,convex}!uiucuxc!gistdev!andy -or-
disclaimer...      |                            ...!uunet!gistdev!andy

phil@mva.cs.liv.ac.uk (08/15/89)

In article <2594@laidbak.UUCP>, rls@laidbak.UUCP (Richard Scott) writes:
> 
> 	I'm wondering how I can produce arbitrarily-shaped buttons in
> Hypercard, such that I could do, for example, a map of an area, where
> within the boundaries of each sub-region, I could do a button action.
> Unfortunately, variations of rectangles just doesn't suffice. Can I
> *draw* a custom button area, using the drawing tools? None of the HyperCard
> books I have say this.

If anyone has any XMCDs etc. that allow you to do this I would like to see
them, otherwise HC itself doesn't allow you to do this with non-rectangular
buttons.
> 
> 	Also, does HyperCard do some sort of caching of it's state, and then
> do occasional buffer flushes (e.g. like UNIX's "sync")? I notice when I'm 
> working on my Sun, I can hear my Mac hard-drive do an access once every few
> minutes or so, but only when HyperCard is running on it (quiescently - on
> the Home card). Just curious.
> 
I think it's updating the minute portion of the time on the home card...

>         rich scott                              {sun,att}!laidbak!rls
>         interactive systems corporation         voice: (800) LAI-UNIX x255
>         naperville, il, usa
Phil Jimmieson,           ***************************************************
Computer Science Dept.,   *                                                 *
Liverpool University,     * JANET : PHIL@UK.AC.LIV.CS.MVA                   *
PO Box 147                * ARPA  : PHIL%mva.cs.liv.ac.uk@cunyvm.cuny.edu   *
Liverpool  L69  3BX       *                                                 *
(UK) 051-794-3689         ***************************************************

fugitt@eos.UUCP (Katherine Fugitt) (08/15/89)

In article <749taylorj@yvax.byu.edu> taylorj@yvax.byu.edu writes:
> Get the Waite Group's "Tricks of the HyperTalk Masters" from Hayden Books.
> There's a chapter in there on making "polybuttons" that is exactly what you
> need.  It's a complicated but beautiful solution.
> 
> Alternately, get SuperCard.  It supports polygon buttons directly.
> 
Not only that, but in SuperCard *any* object (button, field, draw 
graphic, or paint graphic) can support a script with "on mouseUp" or 
"on mouseEnter" or whatever.  In general, I'm fairly happy with SuperCard,
but it is *Quite* slow :-( .

-- 
Katherine Fugitt                       fugitt@eos.arc.nasa.gov      
Graduate Research Assistant            ....!ames!eos!fugitt 
  (aka slave)
Everyone's entitled to their own stupid opinion! :-) :-) :-) :-) :-)

paulm@.UUCP (Paul Morganthall) (08/15/89)

About those limiting rectangular buttons . . .
There is a script in the book "Tricks of the HyperTalk Masters" called
PolyButtons, which gives the effect of non-rectangular buttons.  I just
got the book recently and haven't read that section yet, but it looked
pretty good when I flipped by it.  The book is from The Waite Group.     

---paul
"It's a good thing we don't get all the government we pay for!" -- Will Rogers

dlugose@ecsvax.UUCP (Dan Dlugose) (08/15/89)

In article <2594@laidbak.UUCP> rls@laidbak.UUCP (Richard Scott) writes:
>	I'm wondering how I can produce arbitrarily-shaped buttons in
>Hypercard, such that I could do, for example, a map of an area, where
>within the boundaries of each sub-region, I could do a button action.
>Unfortunately, variations of rectangles just doesn't suffice. Can I
>*draw* a custom button area, using the drawing tools? None of the HyperCard
>books I have say this.

   You can use a rectangular button that encloses your region, and on
mouseup compare the clickloc to the region you have in mind.  Since
HyperTalk processes quite slowly, for irregular regions, you might
want an external function to define the regions and whether a point
is within them.
   Dan Dlugose
   UNC Educational Computing Service

nagel@paris.ics.uci.edu (Mark Nagel) (08/15/89)

dlugose@ecsvax.UUCP (Dan Dlugose) writes:

>   You can use a rectangular button that encloses your region, and on
>mouseup compare the clickloc to the region you have in mind.  Since
>HyperTalk processes quite slowly, for irregular regions, you might
>want an external function to define the regions and whether a point
>is within them.

Also, if it is appropriate, you could use the 'thePixel' XFCN
available in various XFCN collections to determine if the pixel
under the clickLoc is black.  This may not work for all such
regions, but I'd think in general, the combination of this with
other 'point is within' type expressions would work quite well.

For example, I like to use the "double arrow"-type buttons sometimes
(like the ones from the General cdev for changing the current
time).  You can use a single button for this "control" and check
first to see which half of the button was clicked and then whether
the pixel at the clickLoc is black.  This requires that the user
press only in the arrow part.
-- 
Mark Nagel
UC Irvine, Department of Information and Computer Science
ARPA: nagel@ics.uci.edu         UUCP: ucbvax!ucivax!nagel

hpoppe@bierstadt.ucar.edu (Herb Poppe) (08/16/89)

In article <2594@laidbak.UUCP> rls@laidbak.UUCP (Richard Scott) writes:
>
>	I'm wondering how I can produce arbitrarily-shaped buttons in
>Hypercard, such that I could do, for example, a map of an area, where
>within the boundaries of each sub-region, I could do a button action.
>Unfortunately, variations of rectangles just doesn't suffice. Can I
>*draw* a custom button area, using the drawing tools? None of the HyperCard
>books I have say this.
>
Keith Rollin at Apple developed a series of XCMD/XFCNs that allow
a region to be a button. The XCMD/XFCNs are included in a stack called
"Region Button" which demoes them and contains source code as well.
This stack surfaced in 1987.

This stack is not at sumex.stanford.edu nor at apple.com (at least
I couldn't find it there).

I cannot mail this stack.

Herb Poppe      NCAR                         INTERNET: hpoppe@ncar.ucar.edu
(303) 497-1296  P.O. Box 3000                   CSNET: hpoppe@ncar.CSNET
		Boulder, CO  80307               UUCP: hpoppe@ncar.UUCP