[comp.sys.mac.hypercard] Scripting Polygons & New Buttons

woodard@troll.sun.com (Mike &) (02/15/90)

Hypercard and Supercard do something unexpected when I try
to make a polygon from a script. I use:

choose polygon tool	-- (SC choose draw polygon tool )
click at 100,100
click at 100,200
click at 200,100
click at 100,100

but what happens is that after the first click, the first
side of the ploygon is connected to the cursor, and both
programs wait for me to manually click to finish the poly
instead of getting the remaining clicks from the script.
Any ideas?

Also, is there a way to specify a newly created object?
How can I name, or otherwise talk about something thats
brand new?

doMenu "New Button"
set the name of button ??? to "junk"

Mike Woodard
woodard@sun.com

dlugose@uncecs.edu (Dan Dlugose) (02/16/90)

In article <46@exodus.Eng.Sun.COM> woodard@troll.sun.com (Mike &) writes:
>Also, is there a way to specify a newly created object?
>How can I name, or otherwise talk about something thats
>brand new?
>
>doMenu "New Button"
>set the name of button ??? to "junk"
>
In the case of a card button:
   Put the number of card buttons into n
   doMenu "new Button"
  set the name of card button n+1 to "like"&&short name of card button n

Sorry I can't handle other question.

Dan Dlugose
UNC Educational Computing Service

taylorj@yvax.byu.edu (02/19/90)

>Hypercard and Supercard do something unexpected when I try
>to make a polygon from a script.

Sorry, but neither HyperCard or SuperCard let you create a polygon from a
script (with click and drag commands).

You can do it in SuperCard by having a hidden polygon, copying it, then setting
its points to whatever you want.


Jim Taylor
Microcomputer Support for Curriculum
Brigham Young University
taylorj@yvax.byu.edu

GFX@psuvm.psu.edu (02/19/90)

In article <46@exodus.Eng.Sun.COM>, woodard@troll.sun.com (Mike &) says:
>
>Hypercard and Supercard do something unexpected when I try
>to make a polygon from a script.

Right!  I've recently been through what you describe (actually a very nice
feature to have users define new shapes while still in control of a script).
Try the following.  Note that >coordinates< is a container holding the
coordinates of all points used to defined the boundaries of your new button.
Hope this helps.  Stephane

on itemSelect
  set lockScreen to true
.
.
.
    choose button tool
    drag from 10,10 to 20,20 with commandkey
    put the number of buttons of this card into NewArea
    set the style of button NewArea to polygon
.
.
.
    set the autohilite of button NewArea to true
    set the fillback of button NewArea to 37
    set the fillpat of button NewArea to 1
.
.
.
    set the points of button NewArea to coordinates
.
.
.
  choose browse tool
  set lockScreen to false
end itemSelect