
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
MENUS
Create a popup menu from an array of strings
This is how I do it from a 'STR#' resource to a popup menu using pg:pro just make the theText$ = boat$(1) in the loop...
I'm not sure how to do this with a standard menu in the menu bar...
CLEAR LOCAL
LOCAL FN StringListToMenu(myMenu%, myStringList%)
DIM menuHandle&, menuItemCount%, theItem%, theText$
DIM itemCount%
DIM ResErr%, osErr%
menuHandle& = FN installPop(myMenu%)
LONG IF menuHandle&
menuItemCount% = FN COUNTMITEMS(menuHandle&)
LONG IF menuItemCount%
FOR theItem% = 1 TO menuItemCount%
CALL DELMENUITEM(menuHandle&, 1)
NEXT theItem%
END IF
itemCount% = FN countStr(myStringList%)
LONG IF itemCount%
FOR theItem% = 1 TO itemCount%
theText$ = STR#(myStringList%, theItem%)
LONG IF LEN(theText$)
CALL APPENDMENU(menuHandle&, theText$)
END IF
NEXT theItem%
XELSE
theText$ = "empty"
CALL APPENDMENU(menuHandle&, theText$)
END IF
FN deletePop(menuHandle&)
END IF
END FN
Michael Evans
|