MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Question on Dynamic with "DockedCell"

  • To: mathgroup at
  • Subject: [mg104137] Question on Dynamic with "DockedCell"
  • From: Jason Ledbetter <jasonbrent at>
  • Date: Tue, 20 Oct 2009 04:54:42 -0400 (EDT)

I'm attempting to create a dynamically-appearing set of choices/menus using
ButtonBar in a notebook window but I've been unable to get the desired
affect to date. I've cobbled together the following code which almost does
what I'm looking for but I could use some pointers in getting the rest of
the way.

The goal here is for the "topMenu" items to appear when the notebook is
first instantiated and for the "secondMenu" option to appear when a
"topMenu" option is selected. As it stands now, I'm having to start with the
"secondMenu" option pre-defined to a bogus value.

If I were to abstract my goal some more, I'm trying to figure out how to
dynamically add/remove RowBox items that include ButtonBars from the
notebook based on options that are selected.

I'm guessing that I somehow need to programmatically generate the contents
of a Dynamically wrapped RowBox (e.g., Dynamic[RowBox[...]]) but I'm not
quite sure how to go about that just yet.

Any help is greatly appreciated...

Here's what I have thus far:


  {topMenu, secondMenu},

  topMenu = {"option1", "option2"};
  secondMenu = {"No option selected"};

  menuChoice[choice_] := Module[{},
     "option1", secondMenu = {"one", "selected"},
     "option2", secondMenu = {"two", "selected"}, _, Print[choice]

  CreateWindow[DockedCells -> Cell[
        ButtonBar[ToString[#] :> menuChoice[#] & /@ topMenu]
         ButtonBar[ToString[#] :> menuChoice[#] & /@ secondMenu]
   TextAlignment -> Center




  • Prev by Date: Re: Suggestions on how to use standard engineering symbols
  • Next by Date: Re: Animations on mathematica
  • Previous by thread: Re: (1234*(2/3)^(Log[1234]/Log[3])) === (1234^(Log[2]/Log[3])) should
  • Next by thread: Re: Question on Dynamic with "DockedCell"