MathGroup Archive 2009

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

Search the Archive

Re: Dialogue box generator

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

Sorry here is the abutLists code which should have been in the earlier post.


abutLists[l1_,l2_]:=({l1}~Join~{l2})\[Transpose]


----- Original Message ----
From: robert prince-wright <robertprincewright at yahoo.com>
To: Steve Christensen <mathgroup at smc.vnet.net>
Sent: Thu, November 12, 2009 5:53:45 PM
Subject: [mg104904] Dialogue box generator

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: Solving ODE for rotational, irrotational vector field
  • Next by Date: Re: Re: Formatting Numeric Outpuit
  • Previous by thread: Dialogue box generator
  • Next by thread: Re: Dialogue box generator