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

MathGroup Archive 2009

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

Search the Archive

Dialogue box generator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104903] Dialogue box generator
  • From: robert prince-wright <robertprincewright at yahoo.com>
  • Date: Fri, 13 Nov 2009 05:52:00 -0500 (EST)

I have tried to create a DynamicModule that allows you to create a dialogue box with names and variable symbols defined in lists passed as arguments. It's almost working, but not quite, so can someone help me finish it. 

As you can see below the DynamicModule creates a temporary list 'x' with length determined by the number or variables (which is also the number of rows in the Dialogue). The list 'x' is used so that we can plant it in the InputField[Dynamic[....] ] statement. This statement is created by Mapping it onto the 'temp' list which is just an index. Now the module as shown works, but of course i dont want to see the result of the the statement  'Dynamic[ ReleaseHold[ variables=x]]' in the output. All i want is the dialogue so that I can enter data and get the values assigned to the variable symbols (len, width etc). The problem is that I can't find a way of returning the Panel and set sysmbols without the  list. Also the symbols len, width etc keep getting assigned Null values. 

Can someone show me how to sort this out. It will be a usefull snippet when it works!


names = {"Length (m)","Width (m)","Height (m)"};
variables = { len, width, height};

inputDialogue[names_List, variables_List]:=DynamicModule[
{cellSize1,nRows, x, temp, myCell}, 
cellSize1={4,0.75};
nRows= Length@variables;
x=Table[Null,{i,nRows}];
temp = Range[ nRows];
myCell=Table[Null,{i,nRows}];
myCell=Map[InputField[Dynamic[x[[#]]],Boxes, FieldSize->cellSize1]&, temp];
{Panel@Grid[abutLists[names,myCell] , Spacings->{1,0.1}],Dynamic[ ReleaseHold[ variables=x]]}
];
inputDialogue[names,  { len1, width1, height1}]


Robert



      


  • Prev by Date: Re: Non-Linear pendulum
  • Next by Date: Re: NonlinearModelFit on correlated data
  • Previous by thread: Re: Text on a curve, revisited and modified
  • Next by thread: Re: Dialogue box generator