MathGroup Archive 2011

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

Search the Archive

Re: PopupMenu Problems

  • To: mathgroup at
  • Subject: [mg122487] Re: PopupMenu Problems
  • From: A Retey <awnl at>
  • Date: Sun, 30 Oct 2011 04:20:16 -0500 (EST)
  • Delivered-to:
  • References: <j8gnvh$5ig$>

Am 29.10.2011 13:27, schrieb Don:
> Below is the code for a simple PopupMenu
> The purpose is to present the user with a PopupMenu that
> gives two options:  "Linear" or "NonLinear".
> There are two problems with this code:
> (1) The word "Linear" (the default)  is suppose to show up in
> the window next to the right of the word " Function:".
> Right now, it's just left as a blank.  It was thought
> that setting the inital value of the variable "fnc1" to Linear
> would solve that problem.
> (2) After the user makes a choice by clicking on the down arrow and
> clicking on an option (Linear or NonLinear) the
> code should then "fall through" and Print "999" to show
> it is positioned to determine which option the user chose by
> executing the following Which function, but this never happens.
> The act of choosing an option by the user  should  result in executing the Which function and subsequent functions.
> How can this code be modified to fix those two problems?
> Thank you in advance.

Honestly I'm not sure what exactly you try to achieve, your description 
is quite different from what one could guess from the code...

here is a minimal solution which does what you seem to describe:

linear$FE[] := Print["run linear FE"]

nonLinear$FE[] := Print["run nonlinear FE"]

master$FE[] := DynamicModule[{fnc1 = "Linear"},
    Dynamic[fnc1], {
     "Linear" :> linear$FE[],
     "NonLinear" :> nonLinear$FE[]

I think you should have a look at the various possibilities to construct 
a gui that mathematica provides and choose the one most appropriate for 
your task. Then I would always start with concentrating on the 
functionality and only when that is done start with the exact 
formatting. If the above is what you want you can start adding features, 
e.g. the AutoAction -> True option, or more important the Method -> 
"Queued" which is a good idea if your real (non)linear$FE take some time 
to evaluate. Only after that I'd start to care about formatting details...



  • Prev by Date: calculating points
  • Next by Date: I cant get step by step solution @ this diferantial equation
  • Previous by thread: PopupMenu Problems
  • Next by thread: Re: PopupMenu Problems