Edit: I've updated the function it now highlights your selection and returns the selected segment
Did a quick search and found only 1, just quickly skimmed through it and its quite lengthy doesn't need to be that long. Anyway heres another one its short and effective. Just call the function, seperate the text with a semi-colon ; it'll automatically create all segments. Don't place a semi-colon on the end though or you get an extra segment. EG "1;2;3;4;5;bla;bla;bla"
Note: The function doesn't count empty segments as a selection and won't highlight it either, this is useful in some situations such as placing a * next to your selection. But you can easily disable this
Function DropDownList(ListText$,XPOS,YPOS,ImageNumber)
rem USAGE:
rem ListText$ - Text to be displayed in the drop down list, seperate with ;
rem XPOS/YPOS - Position to place the drop down menu
rem ImageNumber - Use this image number as sprites for the list segments
YPOSinc=18: rem IMAGE HEIGHT, Move this up into the function params if you use diff images/heights
SpriteStart=20: rem Make sprites starting at this number
rem Seperate ListText$ into segments
dim Text$(50):temp$="":temp=1:Segments=1
for t=1 to len(ListText$)
if mid$(ListText$,t)<>";" then temp$=temp$+mid$(ListText$,t)
if mid$(ListText$,t)=";" then inc Segments
if mid$(ListText$,t)=";" or t=len(ListText$) then Text$(temp)=temp$:temp$="":inc temp
next t
rem Place drop down list and text
for T=1 to Segments
sprite T+SpriteStart,XPOS,YPOS+(YPOSinc*(T-1)),Imagenumber:hide sprite T+SpriteStart:set sprite T+SpriteStart,0,0:set sprite priority T+SpriteStart,2
paste sprite T+SpriteStart,XPOS,YPOS+(YPOSinc*(T-1))
if mousex()>sprite x(T+SpriteStart) and mousey()>sprite y(T+SpriteStart) and mousex()<sprite x(T+SpriteStart)+sprite width(T+SpriteStart) and mousey()<sprite y(T+SpriteStart)+sprite height(T+SpriteStart) and Text$(T)<>"" then ink RGB(109,172,218),RGB(150,150,150):box XPOS+1,YPOS+(YPOSinc*(T-1)),XPOS+(sprite width(T+SpriteStart)-1),YPOS+(YPOSinc*(T-1))+(YPOSinc-1):ink RGB(10,10,10),RGB(150,150,150)
if mousex()>sprite x(T+SpriteStart) and mousey()>sprite y(T+SpriteStart) and mousex()<sprite x(T+SpriteStart)+sprite width(T+SpriteStart) and mousey()<sprite y(T+SpriteStart)+sprite height(T+SpriteStart) and Text$(T)<>"" then Segment=T
text XPOS+5,YPOS+(YPOSinc*(T-1))+2,Text$(T)
next T
undim Text$(0)
EndFunction Segment
And a small example program, copy the above function into the program and click and hold a mouse button or spacebar to display the drop down list, if you release the button over exit it'll close the program
sync on:sync rate 0
ink rgb(0,0,0),0:backdrop on
box 0,0,100,18:ink rgb(200,200,200),0:box 1,0,99,17:get image 1, 0,0,100,18,1:ink rgb(0,0,0),0
ListText$="File;Open;Save;Save As;Options;;Exit"
do
if mouseclick()=0 then MouseLock=0:Selection=0
if mouseclick()>0 or spacekey()=1
if MouseLock=0 then tempx=mousex():tempy=mousey():MouseLock=1
Selection=DropDownList(ListText$,tempx,tempy,1)
endif
if Selection=7 and mouseclick()=0 then end
text 5,0,"Selection#: "+str$(Selection)
sync
loop