|
[Date Index]
[Thread Index]
[Author Index]
Re: Grabbing a value from a Dynamic Object
- To: mathgroup at smc.vnet.net
- Subject: [mg86858] Re: Grabbing a value from a Dynamic Object
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sun, 23 Mar 2008 03:29:07 -0500 (EST)
- Organization: University of Bergen
- References: <fs4rrq$p93$1@smc.vnet.net>
Todd Allen wrote:
> Hi Folks,
>
> I am trying to use a series of control objects,
> specifically PopupMenus, so that the input to one
> PopupMenu will be used dynamically to provide the
> range of values for the subsequent PopupMenu.
>
> My area is not computer science, but I believe I
> get the idea that Dynamic is not evaluated in the
> kernal, but rather simply formatted in the front end
> of Mathematica. To extract a Dynamic value I have
> been attempting to use the command CurrentValue with
> no sucess.
>
> Here is my basic code:
>
> x = Null; y = Null;
> totgrades = PopupMenu[Dynamic[x], Range[12]]
> temp1 = CurrentValue[totgrades]
> gradesnow = PopupMenu[Dynamic[y], Range[temp1]]
>
>
> I keep getting the error message:
>
> "Range::range: Range specification in
> Range[FrontEnd`CurrentValue[BoxData[3]]] does not have
> appropriate bounds. >>"
>
> I understand that the Head of temp1 is NOT a number,
> but rather is a FrontEnd`CurrentValue.......so, how do
> I get a number that the second PopupMenu can actually
> use to produce a range of potential inputs from the
> user?
>
> I certainly appreciate any advice you might have!
> Mathematica is a wonderful piece of software, but
> there are times when it is truly frustating for a
> beginner.
Dynamic[x] is usually used for *displaying* (or sometimes setting) the
value of x. x must not be wrapped in Dynamic when its value is used.
Try this:
PopupMenu[Dynamic[x], Range[12]]
Dynamic@PopupMenu[Dynamic[y], Range[x]]
Prev by Date:
Re: Which function can do this?
Next by Date:
Re: Writing variables in strings (opened from text files)
Previous by thread:
Re: Grabbing a value from a Dynamic Object
Next by thread:
Packages without packages
|