Andrea Boratto wrote

> Is there a way to create a Windows like drop down list via Lingo.
> Thenks for help.

Yeah - but they can be pretty complicated. Basically, you convert a list to
a RETURN deliminated string, put the string into a field or text member,
change the members size (perhaps make it scrolling), work out which line the
user has clicked on, put the single line back into the field, return its
size, and then call a handler to do something with the selection.

If you are interested, heres some of the key handlers from a 'pop up'
behaviour I created


on mPop me  -- opens the list
  me.mClearHilite()
  --
  mySpriteRef.locZ = myPopZ
  myMemberRef.rect = myPopShape
  myMemberRef.text = myOpenStr
  myMemberRef.boxType = #Scroll
  myState = #Popped
  me.mHilightLine(mySelectedText)
  -- gKeyScriptMgr.mSuspend()
  the keyDownScript = myKeyDownScript -- for the alpha scroller
  the keyboardFocusSprite  = 0
  updateStage
end

on mClose me
  me.mClearHilite()
  --
  myMemberRef.text = mySelectedText
  myMemberRef.boxType = #fixed
  myMemberRef.rect = myNormalShape
  mySpriteRef.locZ = spriteNum
  myMemberRef.scrollTop = 0
  myState = #Closed
  if the keyDownScript = myKeyDownScript then the keyDownScript = EMPTY
   -- gKeyScriptMgr.mResume()
  the keyboardFocusSprite  = -1
  updateStage
end

on mHilightLine me, pWhichLine
  -- called when the field is first opened
  if stringP(pWhichLine) then
     pWhichLine = me.mFindLine(pWhichLine, myOpenStr)
  end if
  if pWhichLine = 0 then
    me.mClearHilite()
  else 
    SelectCharList = me.mGetCharListForLine(pWhichLine)
    CharLoc = charPosToLoc(myMemberRef, SelectCharList[1])
    Vdistance = CharLoc[2]
    vMiddle = (myMemberRef.pageHeight)/2
    if Vdistance > vMiddle then
      -- try and centre
      Vdistance = Vdistance - vMiddle
      -- but dont scroll the last line too far
      LastCharLoc = charPosToLoc(myMemberRef, myOpenStr.char.count)
      maxVDistance = LastCharLoc[2] - myMemberRef.pageHeight
      if Vdistance > maxVDistance then vDistance = maxVDistance
      -- dont scroll the top lines
    else Vdistance = 0
    myMemberRef.scrollTop = Vdistance
    myMemberRef.selection = SelectCharList
  end if
end

The popup behaviour they're from is relatively complex -you can type in a
letter to get the list to scroll to the first line starting with the key,
etc.  If you want to have a look at the full behaviour (and its 'sister
interface behaviour') - let me know, I could put a copy up on our ftp site.
Its not meant to be a very flexible behaviour that can be customised via the
property dialog box (if you want a more flexible behaviour with a simpler
interface, have a look at the behaviours that come with director, or perhaps
the PopUp Xtra from www.updateStage.com.)

Luke



__________________________________________________________________________
Mecca Medialight Pty Ltd

Mecca Medialight:                       Medialight Sound Studio:
111 Moor Street                         1 Bakehouse Lane
Fitzroy, Vic. 3065                      North Fitzroy, Vic. 3068
Tel +613 9416 2033                      Tel +613 9416 2033
Fax +613 9416 2055                      Fax +613 9416 2055

http://www.medialight.com.au
__________________________________________________________________________



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to