Dynamic popupmenu AND dynamic variables
- To: mathgroup at smc.vnet.net
- Subject: [mg98584] Dynamic popupmenu AND dynamic variables
- From: meitnik <meitnik at gmail.com>
- Date: Mon, 13 Apr 2009 03:35:22 -0400 (EDT)
Hi, Ok, I finally got a working parts I needed, however, to work smart, I really hate to hardwire the creation of each group of popupmenus with unique variable names (I have a hundred to go!). Is there any way to create a rule, function etc so I can pass data for the menus and generate unique variable names within. I tried using module but it fails to work. Is this doable? use this code for showing me: mainMenu = {"hey", "you", "now"} stuff = {{"a", "1", "r"}, {"b", "ee", "23"}, {eg,rt,yy}}; f[e_] := Switch[e, "hey", 1, "you", 2, "now", 3]; CreatePalette[ { Labeled[ Row[ { PopupMenu[Dynamic[x], mainMenu, Appearance -> "Palette"], Dynamic[y = stuff[[f[x], 1]]; PopupMenu[Dynamic[y], stuff[[f[x]]], Appearance -> "Palette"]], ActionMenu[ "", { "Insert" :> NotebookWrite[InputNotebook[], y], "Wrap" :> NotebookApply[InputNotebook[], RowBox[{y, "[", "\[SelectionPlaceholder]", "]"}]] }, ImageSize -> {4, 10}, FrameMargins -> 0 ] } ] , lbl, Left] } ] I want to create parameters for mainmenu and stuff; somehow uniquely named variables for x and y on the fly in a sub routine thingy. Thank you.
- Follow-Ups:
- Re: Dynamic popupmenu AND dynamic variables
- From: Andrew Meit <meitnik@gmail.com>
- Re: Dynamic popupmenu AND dynamic variables