Date: Thu Sep 24 11:17:33 MST 1998 From: Zav - Alex Zavatone <zav@sirius.com> Subject: PopUp Menu BehaviorHere is some free code that will do a popup menu.
It is a behavior.
Put it on the item you want to "popup" and you need a text field that will contain the info to put in the popup.
It is system 7 style popup but can easily be changed to operate as OS8
or windows.
- -- Popup Text Menu behavior. © Zav '1997
property pActiveSprite, pPopupCastName
on mouseDown me
set pPopupCastName = "fonts"
PopupMouseDown me
return
end
on PopupMouseDown me --popupCastName
-- put the clickon
set lastChar = the number of chars in field pPopupCastName + 1
set mySprite = the spriteNum of me
set pActiveSprite = mySprite
set myCast = the castnum of sprite mySprite
puppetsprite mySprite, 1
set the castnum of sprite mySprite = the number of cast
pPopupCastName
updatestage
hilite line the mouseline of field pPopupCastName
set myLine = the mouseline
-- highlight detection. Thanks Mark Shepherd
repeat while the mouseDown
if mySprite > 0 then
if rollover(mySprite) then
if myLine <<> the mouseLine then
set myLine = the mouseline
if myLine > 0 then hilite line myLine of field
pPopupCastName
end if
else
if myLine <<> 0 then
set myLine = 0
hilite char lastChar of field pPopupCastName
end if
end if
end if
end repeat
-- here we handle what to do on mouseUp
set the castnum of sprite pActiveSprite = myCast
puppetsprite pActiveSprite, 0
updatestage
if myLine > 0 then
- - Zav
"We write the code that makes the whole world sing..."
DOUG - Director-Online.com for all your musical needs.
http://www.Director-Online.com