on mousedown -- 6 Jan 88 - ToggleFieldStyle by Peter Fraterdeus
--ΓÇóPlease Include these comments if you use my NotePads!
-- This Script was written by Peter Fraterdeus of Alphabets, Inc.
-- CompuServe 73306,2703. In the interest of keeping StackWare healthy -- you could send comments to 804 Dempster St., Evanston, IL. 60202 !
-- Thanks!
--ΓÇóThis works well with the MemoNotes below, since they're card fields
-- Place in Home stack for global relevance…
set lockScreen to true
magicCopy
get the name of the target
if it contains "Field" then
if the shiftKey is down and the commandKey is down then
get style of the target
if it <>"Scrolling" then
set style of the target to scrolling
else
set style of the target to rectangle -- change for a different
end if -- default rect.
end if
else
if it contains "button" and it contains "Note" then
set lockScreen to false
MoveNote
exit to hypercard
end if
end if
end mousedown
**********************
on MoveNote
global gMoveNote
put the mouseLoc into temp
wait 10 -- if the mouse doesn't move within 10 clicks then forget it
get the mouseLoc
if temp<>it then
repeat until the mouse is up -- doDragButton
set the loc of target to the mouseLoc -- a neat trick,
end repeat
put true into gMoveNote -- one of the great qualities of
else
put false into gMoveNote -- object based environments....
end if
send mouseup to target -- I borrowed the concept, but the
choose browse tool -- execution is completely my design...
end moveNote
**********************
on memoNote -- 6 Jan 88 ΓÇö MemoNotesΓäó by Peter Fraterdeus
-- Creates Note button and field on current card.
--ΓÇóShift-OptionΓÇöClick on the MemoNote Button to Copy the button, then
-- go to your Stack and paste it into the Background.
--
--ΓÇóCut this "on memoNote" Script and paste it into the Background,
-- Stack, or Home script. (In Home it will be global for all stacks!)
-- The only script needed in the MemoNoteButton is…
-- "send copyNote" (and "on mouseup…end mouseup", of course!)
--
--ΓÇóThe Scrolling Note area toggles on and off when the Note Button
-- is clicked. Note that you can set the size of the default field
-- by changing fieldWidth and fieldHeight.
--
--ΓÇóPlease Include these comments if you use my NotePads!
-- This Script was written by Peter Fraterdeus of Alphabets, Inc.
-- CompuServe 73306,2703. In the interest of keeping ShareWare healthy -- you could send $15 to 804 Dempster St., Evanston, IL. 60202 !
-- Thanks!
--ΓÇóUpdated 23Jan88 to move notes on click&drag
-- as well as some other polishing of the code
set lockscreen to true
MagicCopy
if the shiftKey is down then -- Shift-Click to edit script*
edit script of me
exit memonote -- * these will work with any button
else
Show msg
put "Click where you want the new Note... (or command-. to cancel)"
beep
set cursor to 2
set lockscreen to true
wait until the mouse is down
put the MouseH into HMouse -- "the clickloc" didn't work here!
put the MouseV into VMouse -- it saved the loc of the MemoNote Bttn.
set cursor to 4
put the number of buttons into ButtonNum
put the number of card fields into FieldNum
put 200 into fieldWidth -- change these for different note size.
put 100 into fieldHeight --
choose button tool
drag from HMouse,VMouse to HMouse+70,VMouse+17 with commandKey -- Draw the new Button
choose field tool -- this actually enables the new button so that
-- its properties may be set...
put "card button (ButtonNum +1)" into it
set name of it to "Note" -- don't change this!
show it
set style of it to Rectangle
set autohilite of it to false
set hilite of it to true
set showname of it to true
drag from HMouse,VMouse+16 to HMouse+fieldWidth, VMouse+fieldHeight with commandKey -- Draw the new Field
choose browse tool -- this actually enables the new field
get the id of card field (FieldNum +1)
set name of card field id it to "Note"&&it
put "card field id " before it
show it
set style of it to Scrolling
set locktext of it to false
set showlines of it to true
set textFont of it to Geneva
set textSize of it to 9
put it into fieldID
-- *** Building the ButtonScript ***
put"*NoteButtonScript*"&return after NoteButtonScript
put"on mouseup"&return after NoteButtonScript
put" global gMoveNote"&return after NoteButtonScript
put" put the visible of"&&Fieldid&&" into showing"&return after NoteButtonScript
put" showfield showing"&return after NoteButtonScript
put"end mouseUp"&return after NoteButtonScript
put"**"&return after NoteButtonScript
put"on killField"&return after NoteButtonScript
put" set the visible of"&&Fieldid&&" to true"&return after NoteButtonScript
put" choose field Tool"&return after NoteButtonScript
put" click at the loc of"&&Fieldid&&""&return after NoteButtonScript
put" domenu clear field"&return after NoteButtonScript
put"end killField"&return after NoteButtonScript
put"***"&return after NoteButtonScript
put"on showField showing"&return after NoteButtonScript
put" global gMoveNote"&return after NoteButtonScript
put" if the paramcount=0 then put false into showing"&return after NoteButtonScript
put" if (showing=false and gMoveNote = false)¬"&return after NoteButtonScript
put" or (showing=true and gMoveNote = true) then"&return after NoteButtonScript
put" -- if the field isn't showing and the button hasn't been moved"&return after NoteButtonScript
put" -- then show the field in its present location"&return after NoteButtonScript
put" -- or if the field is showing but the button has been moved"&return after NoteButtonScript
put" -- then reshow the field in its new location"&return after NoteButtonScript
put" doHilite true"&return after NoteButtonScript
put" get the rect of me"&return after NoteButtonScript
put" put it into bRect"&return after NoteButtonScript
put" get the rect of "&&Fieldid&&""&return after NoteButtonScript
put" put (item 3 of it - item 1 of it) /2 into fH"&return after NoteButtonScript
put" put (item 4 of it - item 2 of it) /2 into fV"&return after NoteButtonScript
put" show"&&Fieldid&&" at trunc(fH)+item 1 of bRect, ¬"&return after NoteButtonScript
put" trunc(fV)+item 4 of bRect-1"&return after NoteButtonScript
put" else"&return after NoteButtonScript
put" doHilite false"&return after NoteButtonScript
put" hide"&&Fieldid&&""&return after NoteButtonScript
put" end if"&return after NoteButtonScript
put"end showField"&return after NoteButtonScript
put"****"&return after NoteButtonScript
put"MemoNotesΓäó Hypernote system"&return after NoteButtonScript
put"©1988 PeterFraterdeus"&return after NoteButtonScript
put"CIS 73306,2703"&return after NoteButtonScript
put"ShareWare-$15. to: Alphabets, Inc."&return after NoteButtonScript
put"804 Dempster St./ Evanston, IL. 60202"&return after NoteButtonScript
choose button tool
set script of card button (buttonNum +1) to NoteButtonScript
choose browse tool
set cursor to 1
send tabKey to fieldID
put " " into msg
end if
end memoNote
***********************
***********************
on ShowNotes -- 7 Jan '88 by Peter Fraterdeus
-- Part of the MemoNotesΓäó system
--ΓÇóSends a mouseUp message to any button named "Note" on a card
-- thus toggling the visiblity of the Note Field
--ΓÇóPut this script in your Home Stack, and use Shift-Opt.Click
-- to copy the ShowNotes button, paste in Bkgnd. of your Stack.
set lockscreen to true
MagicCopy
if the shiftKey is down then -- Shift-Click to edit script*
edit script of me
exit ShowNotes
end if
global HideAll
if hideAll is True then
put "showField false" into doWhat
put False into hideAll
else
put "showField true" into doWhat
put True into hideAll
end if
repeat with btn=1 to the number of card buttons
if the short name of card button btn is "Note" then
send doWhat to card button btn
end if
end repeat
end ShowNotes
***********************
on doHilite OnOff -- onOff must be either True or False if it exists
if the paramcount = 0 then
set the hilite of the Target to not the hilite of the Target
else
set the hilite of the Target to onOff
end if
end doHilite
on MagicCopy -- Magic Button Copy by Peter Fraterdeus
if the shiftKey is down and the optionKey is down and word 2 of the name of the target is "Button"then
choose button tool
click at the loc of the target -- Shift-Opt.Click to copy button*
domenu copy button
put the short name of the target&&"Button copied..." into msg
choose browse tool
exit to hyperCard
end if
end MagicCopy
***********************
on enterkey -- Toggle Browse-Button-Field Tools with EnterKey+Shift
-- I got this out of Macazine, I believe, from Jerry Daniels and added
-- the ShiftKey modifier
if the shiftKey is down then
if the tool is "browse tool" then choose button tool
else if the tool is "button tool" then choose field tool
else choose browse tool
end if
end enterkey
***********************
on KillNotes -- 7 Jan '88 by Peter Fraterdeus
--ΓÇóSends a Killnote Message to the Note Button selected, removing
-- both field (is cut to Clipboard), and button.
--ΓÇóPut this script in your Home Stack, and use Shift-Opt.Click
-- to copy the KillNotes button, paste in Bkgnd. of your Stack.
set lockscreen to true
MagicCopy
if the shiftKey is down then -- Shift-Click to edit script*
edit script of me
exit Killnotes
end if
put "Click on NoteButton of note to Clear. (Or elsewhere to cancel)"
beep
wait until the mouse is down
put the mouseLoc into MsLoc
set cursor to 4
repeat with whichButton=1 to the number of card buttons
put "card button"&&whichButton into it
put the rect of it into targRect
if PointinRect(MSLOc,TargRect) =true and short name of it = "Note" then
send killField to it
choose button tool
click at Loc of it
domenu clear button
set cursor to 1
choose browse tool
put " " into msg
exit killNotes
end if
end repeat
set cursor to 1
choose browse tool
put " " into msg
end KillNotes
***********************
These are just some little helpers for finding the name and sizes
of objects
***********************
on showRect targ
put the rect of targ into msg
end showRect
on getSName targ
put the short name of targ into msg
end getSName
on getName targ
put the name of targ into msg
end getName
on showHV targ
getrect (targ)
getHV (targ)
put dH && dV into msg
end showHV
function getHV targ
global dH,dV
getrect (targ)
put item 1 of it - item 3 of it into dH
put item 2 of it - item 4 of it into dV
end getHV
function getRect targ
return the rect of targ
end getRect
function PointinRect apoint,aRect
if item 1 of apoint >= item 1 of aRect and item 1 of apoint <= item 3 of aRect and item 2 of apoint >= item 2 of aRect and item 2 of apoint <= item 4 of aRect