New topic: Enumerations and PopupMenus
<http://forums.realsoftware.com/viewtopic.php?t=29720> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message Fishy Post subject: Enumerations and PopupMenusPosted: Mon Aug 24, 2009 5:42 pm Joined: Fri Dec 16, 2005 10:19 pm Posts: 488 I often find myself having an enumeration, and needing to allow the user to select and item from the enumeration using a popup menu. There isn't some fancy way using introspection (or otherwise) to get the values and names for all the items in an enumeration is there? I basically want a popup menu like the menu in the IDE has for setting control default values from enumerations (such as mode for timers) Also, I often would like to associate data with each item in an enumeration (usually a strong). This could be the name of the item or have a list of string constants that behave like an enumeration, or match strings to each value in an enumerations (Such as error text to each error code). I see a few approaches: big select case statements (one case for each item in the enum), hordes of constant strings (use instead of the enum), or building dictionaries to match enum values to strings (That actually could be made to work pretty well, though I would rather create the connections at compile time than run time). Is there a way this is usually done? _________________ - Craig Macomber - See my rb apps at: http://www.spincraftsoftware.com/ Lead Programmer for Fragmented Galaxy, an MMORTS: http://f-g.wikidot.com/ Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
