The scrolling field below contains the polyedit documentation file. This file also exists in MS-Word format.
-- part contents for card part 1
----- text -----
POLYEDIT XFCN
©1990 Greg Anderson
The polyedit XFCN was implemented to relieve the HyperTalk scriptor the tedium of entering polybutton definition lists by hand. Using the polyedit XFCN, it is possible to drag polybuttons around on the HyperCard card or background and dynamically change their shape, all with clicks of the mouse button. Polyedit automatically generates polybutton definition lists from the graphical information supplied by the user during editing.
WARNING:This is a pre-alpha version of this XFCN. Use with caution. The author assumes no responsibility for any damage caused to your stacks resulting from the use of this XFCN. Always use polyedit on backup versions of your stacks.
INSTALLING THE POLYEDIT XFCN
Unlike the polybutton XFCN, the polyedit XFCN has several supporting resources it requires in order to operate effectively. They are:
Cursors:29328PolyEdit's Cursor
29329PolyEdit's Pinching Hand
DLOG:29328PolyEdit's Info Dialog
DITL:29328PolyEdit's Info DITL
Be sure to copy these resources to your home stack when you are installing the polyedit XFCN.
In addition, there are several scripts that complement polyedit quite nicely if they are placed in the script of your home stack. If these scripts are not included, not all of the features described below will function.
The scripts are:
on doMenu which
global polyVar
if which is "New Polybutton" then
get polyedit(the optionkey is up)
else
pass doMenu
end if
end doMenu
on choose what,n
global polyVar
if what && n is "tool 2" and the optionkey is down then
get polyedit(false)
else
pass choose
end if
end choose
Of course, you will need to modify these scripts slightly if you have existing 'doMenu' or 'choose' scripts in your home stack already.
Finally, you will probably wish to create a "New Polybutton" menu item in your version of HyperCard. (If you don't like to modify the resource fork of your executable copy of HyperCard, then you will not need the 'on doMenu' handler either.)
The steps you will need to take are:
1. Open "HyperCard" with Resedit.
2. Double-click on its "MENU" resources.
3. Open the first "Objects" menu you see (ID 6, I think).
4. Add a new item to the BOTTOM of the list. Call it "New Polybutton"
5. Do the same thing to the other "Objects" menu at the bottom of the list (ID 106).
I have not tried this under HC 2.0--it should work just as well, but the resource IDs may vary.
USING POLYEDIT
To create a new polybutton, select "New Polybutton" from the "Objects" menu. (Note: this only works if you added a "New Polybutton" item with ResEdit and installed the 'on doMenu' script described in "Installing PolyEdit". If you skipped either of these steps, you must type "polyedit(true)" into the message box to create a new polybutton.) All new polybuttons initially are three-node equilateral triangles.
ΓÇóTo edit a polybutton, click on it once.
ΓÇóDouble-clicking on a polybutton brings up its information dialog box where you can name the polybutton and specify its parameters.
Clicking outside all polybuttons exits polyedit mode. To re-enter polyedit mode without creating a new polybutton, hold down the OPTION key while selecting the button tool from the "Tools" menu. (Note: this only works if you installed the 'on choose' handler described in "Installing PolyEdit". If you skipped this step, you must type "polyedit(false)" into the message box to get back into polyedit mode.)
The active polybutton (the last one clicked on) is indicated with a marching-ant border and thick black dots at each of its nodes.
ΓÇóTo move the active polybutton, just click on it and drag it around.
ΓÇóShift-click and drag the polybutton if you want a constrained (horizontal-only or vertical-only) drag.
ΓÇóOption-click and drag the polybutton to create a copy of it.
Whenever the cursor passes over a node of a polybutton, it changes into a pinching hand to indicate that you may edit the node.
ΓÇóTo move a node, just click on it and drag it around.
ΓÇóShift-clicking will produce a constrained drag when editing nodes also.
ΓÇóOption-clicking the node will create a new node. This is the only way to create new nodes with polyedit.
ΓÇóTo delete a node, drag it on top of another node. This is the only way to delete nodes with polyedit.
That just about covers the options available with polyedit. Please refer to the polybutton XFCN documentation for a discussion on implementing the scripts for your new polybuttons.
BUGS AND LIMITATIONS OF POLYEDIT
This is version 1.0d11 of polyedit. The "d" stands for development--that means that this XFCN is not finished. It has the following known limitations and bugs:
ΓÇóPolyedit will only allow you to have 30 nodes in any single polybutton. This limit may be increased by changing a #define in the polybutton source code, but the real reason for its existence is that polyedit will not dynamically allocate more memory for polybuttons being edited. This is a limitation that will be removed in future versions.
ΓÇóPolyedit cannot delete polybuttons.
ΓÇóPolyedit does a HyperCard callback that sets the script of the card and the background when editing polybuttons ("set the script of this bg to polyVar"). If a bug in polyedit were to cause the contents of 'polyVar' to become corrupted, polyedit could end up doing the equivalent of "set the script of this bg to empty". This would be bad for your script. ;) Always work with a backup copy of your stacks when using polyedit (or any other pre-alpha XFCN!). No bug like this has ever bitten me, but you wouldn't want to discover a condition where it happens when editing the only copy of one of your stacks.
Polyedit is a stable and relatively complete XFCN. If it were not, I would not release it to the net. None the less, you should use it with caution.