MathGroup Archive 2007

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

Search the Archive

Creating a popup menubox in a specified notebook

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82380] Creating a popup menubox in a specified notebook
  • From: "tom_toad at telus.net" <tom_toad at telus.net>
  • Date: Fri, 19 Oct 2007 04:51:57 -0400 (EDT)

Hello!

I wonder if anyone can give me a bit of help with this problem.

I am thinking of using the  popupmenubox  idea in the tests I create
in my math classes.

Students would use the menu to select a response.

These responses would be stored in variables corresponding to the
problem number.

For example

	PopupMenu[Dynamic[p1], {"a", "b", "c", "d", "e"}]
would create a popup menu with 5 choices,  and the choice would be
stored in variable p1

	PopupMenu[Dynamic[p2], {"a", "b", "c", "d", "e"}]
would create a popup menu with  5 choices,  and the choice would be
stored in variable p2


I have written some programs that create "random" math problems and
answers,  and use this to create math tests and assignments


Here is my problem

I can create a popupmenu in another window  using the following
first create a new notebook

fred = CreateWindow[];

then create the popup menu in the new notebook....  the cell context
of p1  would mean the choice would be stored in variable p1

NotebookWrite[fred,
 Cell[BoxData[
   PopupMenuBox[
    Dynamic[$CellContext`p1], {"a" -> "\<\"a\"\>", "b" -> "\<\"b\"\>",
     "c" -> "\<\"c\"\>", "d" -> "\<\"d\"\>", "e" -> "\<\"e\"\>"}]],
"Output"]]



How would I write that so I can build a line where the cell context
can be changed under program control....  I.E.  how would I create the
expression for the $CellContext`p1   part of that line if the variable
will be different for each question  (say p1 for problem1,  p2 for
problem 2, and so on)

I could then take my list of CORRECT answers , compare them with the
list  {p1, p2, .....  }   and "autograde"   the test.

Perhaps the whole idea is crazy,  I was just thinking of ways I might
learn and use some of these new features in Mathematica 6.

Any comments or ideas would be appreciated.

Sincerely,

Tom De Vries



  • Prev by Date: Re: Setting up external functions to be called from Mathematica
  • Next by Date: Re: Re: ListPlot: Choose segents to draw.
  • Previous by thread: Re: Ver 6.0 Subsets and Packed Array Question
  • Next by thread: A riddle: Functions that return unevaluated when they cannot solve