Dynamic Menus

Share your advanced PureBasic knowledge/code with the community.
localmotion34
Enthusiast
Enthusiast
Posts: 665
Joined: Fri Sep 12, 2003 10:40 pm
Location: Tallahassee, Florida

Dynamic Menus

Post by localmotion34 »

ok with a program i was writing for school, i needed a way to keep track of a list of items i was working with, put that list into a menu, and be abe to retrieve the text and have a DEFAULT action for each item added. so here is a snippet of code that allows you to

1) get a menuitems text
2) shows a SIMPLE example of using an INI file to retrieve items and then add them to a popup menu
3) shows how to use the DEFAULT case in the eventmenuid() to perform a generic action. i.e. runprogram(getmenutext(hmenu,eventmenuid()))

http://www.penguinbyte.com/apps/pbwebst ... c_Menu.zip

not my finest work, but perhaps very useful to someone who had absolutely no clue about this like i did until now.

Code: Select all

!.WHILE status != dwPassedOut
! Invoke AllocateDrink, dwBeerAmount
!MOV Mug, Beer
!Invoke Drink, Mug, dwBeerAmount
!.endw