Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Firefly CD Burning Xtra
CD Everywhere
Director Web
mPrint Designer
Wise Install Maker
DirectMedia Xtra 2
Angle detection by J.R.D.R.
Composite Images with Alpha
Reverse a list
Drop Files setup
 

 

 

Behavior Select From DropDown List

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: TonyBray

A behaviour to display a list of items, automatically select a pre-deterimed item from the list and then display the selection in another field. This program runs automatically as it is used for a demonstration.

--Could change the enterFrame to be mouseEnter and include a mouseUp handler to allow the user to make the selection.
--Drag onto the field sprite that will display the selection. pDisplayFld = the field in which the final selection is displayed. pListFld = the cast member containing the list of items to select from. pHilite = the line number of the selection. Ensures that the item is highlighted to  show the user which item has been selected.
property  pDisplayFld, pListFld,pHiliteLine

-- EnterFrame changes the dropdown list to reflect the required text.
-- field "empty list" is the field that is used to display the list.
-- the list of items is put into this field.
on enterFrame me
  put field ( the pListFld of me) into field "empty list"
  -- wait so that the list is displayed for a short period before the
  -- selection is highlighted
  waitLst 30
  hilite line pHiliteLine of field "empty list"
  -- wait so that selection is displayed for a short period before the
  -- selection is put into the dispaly field.
  waitLst 60
  put line pHiliteLine of field "empty list" into field (the pDisplayFld of me)
END

-- make sure that the fields are empty so that nothing is "left over" from a previous call.
on beginSprite me
  put " " into field "empty list"
  put " " into field (the pDisplayFld of me)
end

-- waitLst just pauses the movie for the time howlong.
ON waitLst howlong
  startTimer
  repeat while the timer < howlong
    nothing
  end repeat
END waitLst


on getPropertyDescriptionList
  if the currentspritenum <> 0 then
    -- these variables ensure that the appropriate fields are
    -- displayed in the dialogue box. Ensures that you are "close" to the
    -- required fields, which helps when you have a long list of fields to select from.
    -- You can still select a different set of fields if required.
    set myMemref = the member of sprite the currentspritenum
    set myDisplayFld = the name of member myMemref
    set myFstWord = word 1 of myDisplayFld
    set myListFld =  member (myFstWord && "menu")
    
    set p_list = [:]
    addProp p_list,#pListFld,[ #comment:"Select field containing the list.",#format:#field, #default: myListFld ]
    addprop p_list,#pDisplayFld,[ #comment:"Select field to display selection.", #format:#field, #default: myDisplayFld ]
    addprop p_list,#pHiliteLine,[ #comment:"Enter the line number for the hilite.", #format:#integer, #default:2 ]
    put p_list
    return p_list
  end if
end

on getBehaviorDescription
  return
            "Select a list of items and the field to display the selection in." & RETURN &
            "PARAMETERS:" & RETURN &
            "• List field - Select the field containing a list of items to be selected from."& RETURN &
            "• Display field  - Select the field that will display the result of the selection from the list of items."&RETURN&
            "• Line number - Enter the number of the line in the selection list to be hilited."
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail