Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Dynamic GUI problem II.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89508] Re: Dynamic GUI problem II.
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 11 Jun 2008 03:18:55 -0400 (EDT)
  • References: <g2fub0$2fs$1@smc.vnet.net> <g2j0ab$558$1@smc.vnet.net> <g2lbf9$9aq$1@smc.vnet.net>


Hi,

hope you come not back with an even trickier problem. Anyway, during 

playing around I got the impression that Dynamic still has some 

problems. Here is one way of doing what you want:

fun[n0_]:=DynamicModule[{n=Round[n0],t,tt,vars},

vars=Table[Dynamic@Evaluate@Unique[],{n}];

t=(Slider[#])&/@vars;

(Evaluate[#[[1]]]=0.5)&/@vars;

Column[{t,vars}]//Print;

];

n=.;

Slider[Dynamic[n,{(n=#;fun[n])&}],{1,5}]

hope this helps, Daniel



zac wrote:

> Thank you for the reply, it partly solves my problem, but what if I

> want to control the length of the array 'vars' as well with a slider?

> Here is my proposed - not working - layout, based on your code:

> 

> Remove[vars, a, x, v, n];

> {Slider[Dynamic[n], {1, 5, 1}], Dynamic[n]}

> a = Table[RandomReal[], {n}]

> vars = Dynamic /@ Array[v, {n}];

> x = (Slider[#, ImageSize -> 50] & /@ vars)

> MapThread[Set[Evaluate[#1[[1]]], #2] &, {vars, a}];

> vars

> 

> Clearly the problem starts when variables 'a' and 'vars' do not update

> with the change of n. Of course, if I wrap the Table[...] and Array[]

> expressions into Dynamics, MapThread won't recognize them as lists. Is

> there any way to define 'n' as an always-dynamic-variable (other than

> incorporating the whole thing into a Manipulate)?

> Any ideas?

> 

> Istvan

> 





-- 



Daniel Huber

Metrohm Ltd.

Oberdorfstr. 68

CH-9100 Herisau

Tel. +41 71 353 8585, Fax +41 71 353 8907

E-Mail:<mailto:dh at metrohm.com>

Internet:<http://www.metrohm.com>




  • Prev by Date: Re: Transform list of numbers into pure functions using replace rule
  • Next by Date: Re: Problem inputting data into a table that is larger than a window
  • Previous by thread: Re: Dynamic GUI problem II.
  • Next by thread: Re: Dynamic GUI problem II.