Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6032

Re: PopupMenu Problems

From A Retey <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: PopupMenu Problems
Date 2011-10-30 09:21 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8j4u6$etj$1@smc.vnet.net> (permalink)
References <j8gnvh$5ig$1@smc.vnet.net>

Show all headers | View raw


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"},
   ActionMenu[
    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...

hth,

albert

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

PopupMenu Problems Don <donabc@comcast.net> - 2011-10-29 11:27 +0000
  Re: PopupMenu Problems A Retey <awnl@gmx-topmail.de> - 2011-10-30 09:21 +0000
  Re: PopupMenu Problems Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-30 09:31 +0000

csiph-web