--------- DISPLAY CURSORPOSITION ____________________________________________________________
--___________________________________________________________________________________________
--
-- This behavior shows the cursors position in a field on mousedown,
-- or else on enterframe. With an option to change the fields backcolor
-- when the mouse is down. Use this behavior in the scriptchannel, or
-- drop it on a sprite, or the stage.
--
-- 10/07/2000 Kurt Koenig * Belgium
--
-- New E-mailaddress: k.k@pi.be
--
--____________________________________________________________________________________________
addprop desclist, #pTheField,[#comment:¬
"Display the cursor position in which field:", ¬
format: #field , default: ""]
addprop desclist, #pFieldCol,[#comment:¬
"Change the fields backcolor on mousedown ?:", ¬
format: #Boolean , default: FALSE]
addprop desclist, #pNewCol,[#comment:¬
"Change the fields backcolor to which color (0-255) ?:", ¬
#default:5, #format:#integer, #range:[#min:0,#max:255]]
addprop desclist, #pWhatAction, [ #comment:¬
"Display cursor position on which action?", ¬
#format: #symbol, #range:[#Enterframe, #Mousedown],¬
#default: #Mousedown]
return desclist
end getPropertyDescriptionList
on getBehaviorDescription
return " This behavior shows the cursors position in a field on"&return&" ¬
mousedown, or else on enterframe. With an option to"&return&" ¬
change the fields backcolor when the mouse is down."&return&" ¬
Use this behavior in the scriptchannel, or drop it on a"&return&" ¬
sprite, or the stage."&return&"¬
Kurt Koenig * Belgium"
end getBehaviorDescription
on getBehaviorTooltip me
return "This behavior shows the"&return&"¬
cursors position in a field."
end getBehaviorTooltip
-- Store the stagedimension and the fields backcolor.
on beginsprite
pOldCol = (pTheField).backcolor
pSH = the stageBottom - the stageTop
pSW = the stageright - the stageleft
end beginsprite
on enterFrame
gMousePos = the mouseloc
if pWhatAction = #enterFrame or pWhatAction = #mousedown then
doIt
end if
end
--Hold on the frame
on exitframe
go the frame
end exitframe
on doIt
if pWhatAction = #enterFrame then
option1
else
if pWhatAction = #mousedown then
option2
end if
end if
end
-- When enterframe is selected in the parameterwindow...
on option1
--Clear the field when the mousecursor is not over the stagewindow.
if the mouseH < pSW - pSW or the mouseH > pSW¬
or the mouseV < pSH - pSH or the mouseV > pSH then
put "" into field pTheField
-- Restore the fields color.
(pTheField) . backcolor = pOldCol
else
-- If the option to change the fieldcolor
-- is checked in the parameterwindow.
if pFieldCol then
-- Use the NewColor for the field when the mousecursor is over the stage.
(pTheField). backcolor = pNewCol
pMousePos = the mouseloc
put "H"&&pMousePos[1]&&"V"&&pMousePos[2] into field pThefield
updatestage
end if
end if
end option1
-- When mousedown is selected in the parameterwindow...
on option2
repeat while the mousedown
--Clear the field when the mousecursor is not over the stagewindow.
if the mouseH < pSW - pSW or the mouseH > pSW¬
or the mouseV < pSH - pSH or the mouseV > pSH then
put "" into field pTheField
-- Restore the fields color.
(pTheField) . backcolor = pOldCol
else
-- If the option to change the fieldcolor
-- is checked in the parameterwindow.
if pFieldCol then
-- Use the NewColor for the field when the mousecursor is over the stage.
(pTheField). backcolor = pNewCol
pMousePos = the mouseloc
put "H"&&pMousePos[1]&&"V"&&pMousePos[2] into field pThefield
updatestage
end if
end if
end repeat
end option2
-- Clear the field and restore the fields backcolor when the mousebutton is released.
on mouseup
(pTheField) . backcolor = pOldCol
put "" into field pTheField
end mouseup
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA