---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
-- 29 InternalCursors --------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
-- Change the cursor to another one when over a sprite.
-- 29 cursors available, a few are Mac only...
-- In D7 you could set most of them in the behavior inspector window
-- In D8 no more...(as far as I know)
--
-- november, 2000
--
-- Kurt Koenig * Belgium
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
property spriteNum, pInitCurs, pChangedCurs
on getpropertydescriptionlist me
if not the currentSpriteNum then exit
pThisSprite = sprite(the currentSpriteNum).member
memberType = pThisSprite.type
permittedType = RightMemberType(me)
if not permittedType.getPos(memberType) then
return ErrorAlert (me, #PDLError, permittedType)
end if
desclist = [:]
addprop desclist,#pChangedCurs,[#comment: "The cursor to change to when over a sprite:",¬
#format: ¬
#string, ¬
#range:¬
[¬
#Arrow, ¬
#Ibeam, ¬
#Crosshair, ¬
#Crossbar, ¬
#Hourglas, ¬
#NoCursor, ¬
#Help, ¬
#Finger, ¬
#Hand, ¬
#ClosedHand, ¬
#NoDropHand, ¬
#CopyClosedHand, ¬
#Pencil, ¬
#Eraser, ¬
#Select, ¬
#Bucket, ¬
#Lasso, ¬
#Dropper, ¬
#AirBrush, ¬
#ZoomIn, ¬
#ZoomOut, ¬
#VerticalSize, ¬
#HorizonalSize, ¬
#DiagonalSize, ¬
#WhiteArrowMac, ¬
#BlackArrowOutlinedWin, ¬
#Magnify, ¬
#WaitMouse1Mac, ¬
#Waitmouse2Mac¬
],¬
#default: ¬
#Arrow¬
]
addprop desclist,#pInitCurs,[#comment: "Back to original after leaving the sprite?:",¬
#format: ¬
#boolean, ¬
#default:¬
TRUE¬
]
return desclist
end
on getBehaviorDescription me
return "¬
ChangeCursor"&RETURN&"¬
This behavior changes the cursor"&RETURN&"¬
when the mousepointer is over a "&RETURN&"¬
sprite. You can use 29 different cursors "&RETURN&"¬
KK * Belgium"
end getBehaviorDescription
on Initialize me
TheSprite = sprite(me.spriteNum)
pThisSprite = TheSprite.member
memberType = pThisSprite.type
if not RightMemberType(me).getPos(memberType) then
ErrorAlert (me, #WrongMemberType, memberType)
end if
end Initialize
-- Return the type, so an alertmessage can be displayed if the membertype is invalid.
on RightMemberType me
return [#button, #bitmap, #shape, #vectorshape, #field, #text]
end RightMemberType
-- Store the initial cursor
on beginSprite me
Initialize me
end
-- Based on James Newton's error handling code
on ErrorAlert me, theError, data
case theError of
#PDLError:
alert "¬
Error: This behavior works only with the following member types:"&RETURN&¬
RightMemberType(me)&RETURN&RETURN&"¬
Hit OK and then delete this behavior from the sprite. See the Help¬
system for details on deleting behaviors. KK"
if the optionDown then
return [ #PDLError:[ #comment: "ERROR: Wrong member type. Click 'Cancel'.", ¬
#format: #string, #range: [""], #default: ""]]
end if
otherwise
behaviorName = string (me)
delete word 1 of behaviorName
delete the last word of behaviorName
delete the last word of behaviorName
case data.ilk of
#void: data = ""
#symbol: data = "#"&data
end case
case theError of
#WrongMemberType:
alert "BEHAVIOR ERROR: Frame "&the frame&", Sprite "&me.spriteNum&RETURN&RETURN&"¬
Behavior "&behaviorName&" only functions with the following member types: "&¬
RightMemberType()&RETURN&RETURN&¬
"Current type = "&data
halt
end case
end case
end ErrorAlert
-- Change the cursor when the mousepointer is over the sprite