Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6924561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:40:43+00:00 2026-05-27T10:40:43+00:00

I am running out of space on the Manipulate interface. So, I am looking

  • 0

I am running out of space on the Manipulate interface. So, I am looking to see if I can overload a PopupMenu to serve more than one purpose.

Here is the problem:

I have a PopupMenu where I use to select an entry from it. But depending on another choice I make somewhere else, some of these entries in the menu will no longer make sense to select.

So, I was wondering, if I can make some of the entries in the PopupMenu ‘selectable’ based on a setting of a Dynamic? (may be disabled, or grayed out, or what would be best, have the whole list itself by dynamic, i.e. the whole popUp menu be dyanmic, so I can select different menus based on value of another dynamic. But I do not think this is possible)

Currently, the WHOLE PopupMenu can be enabled or disabled based on a dynamic setting. But I want to do this at the entry level inside the Popupmenu.

Here is an example to illustrate:

Manipulate[selection,
 Grid[{
   {"x", SetterBar[Dynamic[x], {1, 2}]},
   {"selection", PopupMenu[Dynamic[selection],
     {
      "NONE", "SOR", "SSOR"
      }, Enabled -> Dynamic[x == 1]], SpanFromLeft
    }
   }]
 ]

enter image description here

In the above, when X=1, the whole menu is enabled.

But what I want, if X=1, is to be able to select only say “NONE” (or the list just show “NONE”), and when X=2, then be able to select only “SOR” and “SSOR” (or the list just show these 2 choices).

i.e. the system will not let “SOR” be selected if x=2. Trying to select it will cause no change and the menu will remain on its previous setting and not change.

Again, I know I can break things into 2 popuMenus, and control each one based on X setting like this below, but I do not have more space to add more menus:

Manipulate[If[x == 1, selectionA, selectionB],
 Grid[{
   {"x", SetterBar[Dynamic[x], {1, 2}]},
   {"selection", PopupMenu[Dynamic[selectionA],
     {
      "NONE"
      }, Enabled -> Dynamic[x == 1]], SpanFromLeft
    },
   {"selection", PopupMenu[Dynamic[selectionB],
     {
      "SOR", "SSOR"
      }, Enabled -> Dynamic[x == 2]], SpanFromLeft
    }
   }]
 ]

enter image description here

My question is: Is there a way to do the above in Mathematica? I am using 8.04.

Best solution would be to have the list of items for the menu itself by Dynamic (or the whole menu be dynamic), so I can tell it to use listA when X=1 or use listB when X=2, etc.. But I do not know how to do this and do not know if it is even possible.

ps. This is my current attempt at a solution

Manipulate[selection,

 Grid[{
   {"x", SetterBar[Dynamic[x], {1, 2}]},
   {"selection", PopupMenu[Dynamic[selection],
     {
      Dynamic[If[x == 1, listA, listB]]
      }
     ]
    }
   }
  ],
 Initialization :>
  (
   listA = {"A", "B"};
   listB = {"C", "D"};
   )
 ]

But it is not working too well yet. Will keep at it….

thanks

Update:

Looking at Simon solution below inspired me a little more, so this is what I have so far:

Manipulate[selection,

 Grid[{
   {"x", SetterBar[Dynamic[x], {1, 2}]},
   {"selection",

    Dynamic[If[x == 1,
      (
       selection = "A";
       PopupMenu[Dynamic[selection], {"A", "B"}]
       ),
      (
       selection = "C";
       PopupMenu[Dynamic[selection], {"C", "D"}]
       )
      ]
     ]
    }
   }
  ]
 ]

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:40:44+00:00Added an answer on May 27, 2026 at 10:40 am

    Is this the type of thing you’re looking for?

    Manipulate[
     Switch[x,
            1, If[selection =!= None, selection = None],
            2, If[selection === None, selection = "SOR"]];
     selection,
     {x, {1, 2}, ControlType -> SetterBar},
     {{selection, None}, Switch[x, 1, {None}, 2, {"SOR", "SSOR"}, _, {"huh"}], 
      ControlType -> PopupMenu}]
    

    Note the Switch at the top that controls the defaults for selection when x is changed.


    Edit:

    Following your request to have the menu logic localised to the control Grid and stealing Heike’s default mechanism, here’s a new version:

    Manipulate[selection,
     Grid[With[{menu = {{None}, {"A", "B"}, {"emu", "num"}}},
       {{"Which menu?", SetterBar[Dynamic[x], Range[Length[menu]]]},
        {"Menu selection:", Dynamic[
          If[MemberQ[menu[[x]], selection], selection = menu[[x, 1]]];
          PopupMenu[Dynamic[selection], menu[[x]]]]}}]],
     {{selection, None}, None}, {{x, 1}, None}]
    

    a boring screenshot

    Note that the menu list does not need to be localized with a With statement – it can be set elsewhere in the code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My vserver is running out of space. I noticed the traffic stats of apache
As I am running out of my space on GitHub on my free account
I'm using DOMPDF to generate about 500 reports from one script. It's running out
The server where CruiseControl.NET is already installed is running out of disk space. Is
I'm running a wordpress off of AWS, and I can't figure out how to
We have a server running PHP (windows). We've run out of HD space with
I'm trying to help a wonderful designer who is sadly running out of space
guys am having some troubles with running out of memory when displaying an animation
I have a SL 4.0 app running out of browser with full priviliges. How
I am trying to figure out why Jetty 6.1.22 is running out of memory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.