# Preforming Operations on Input Fields [closed]

I'm setting up a CDF document (in mathematica 9) that takes a cone and plots a point on it. The input required from the user is the radius of the cone at the base, the height of the cone, and two of the three coordinate values for the point on the cone.

ie. You tell the program its a cone with base radius 100, height 100, X=50 and Z=50 and it calculates that Y is zero to proceed with the rest of the program.

I'm currently using input fields for all of these values (code to follow) and am trying to use buttons to update the values in the fields. So you could enter the radius, the base, X and Y and then press the Z button to populate the field.

What I've tried to do is this:

    xButton[initialY_,initialZ_, coneBase_, coneHeight_]:=
Button["X",
checkInitialXInitialY[initialY,initialZ,coneBase,coneHeight]
]
yButton[initialX_,initialZ_, coneBase_,coneHeight_]:=
Button["Y",
checkInitialXInitialY[initialX, initialZ, coneBase, coneHeight]
]
zButton[initialX_,initialY_, coneBase_,coneHeight_]:=\
Button["Z",
checkInitialXInitialZ[initialX,initialY,coneBase,coneHeight]
]

(*Input Box *)
initialXInputProperties={initialX=xButton[initialY,initialZ,coneBase,coneHeight],"Unit"->"Length","Unit"->"Length","Tooltip"->"Distance from the y-axis."};
initialXInputMessage="initialX should be a number.";
initialYInputProperties={initialY=yButton[initialX,initialZ,coneBase, coneHeight], "Unit"->"Length","Unit"->"Length","Tooltip"->"Distance from the x-axis"};
initialYInputMessage="initialY should be a number";
initialZInputProperties={initialZ=zButton[initialX,initialY,coneBase,coneHeight],"Unit"->"Length", "Unit"-> "Length","Tooltip"->"Height from apex "};
initialZInputMessage="initialZ should be a positive number";

SetAttributes[initialPointInputBox, HoldAll];
initialPointInputBox   [initialX_,initialXValidQ_,initialY_,initialYValidQ_,initialZ_,initialZValidQ_, coneBase_,coneHeight_] :=
inputColumn[{
inputColumnTitle[{"Intersection of centerline of cylinder and cone"}],
{"",Image[E0819Ainputs2,ImageSize->450]},
inputField[initialX, initialXInputProperties],
warningMessage[!initialXValidQ,initialXInputMessage],
inputField[initialY, initialYInputProperties ],
warningMessage[!initialYValidQ, initialYInputMessage],
inputField[initialZ, initialZInputProperties],
warningMessage[!initialZValidQ, initialZInputMessage]
}];


The information about the cone is collected in an earlier input box and all of the variables are declared as dynamic in dynamic module. The code shown above turns the labels for the X,Y, and Z input boxes into buttons, but when I click them it doesn't repopulate the input fields. The function checkInitialXInitialY returns the missing Z value and checkInitialXInitialZ returns the missing Y value (or X if the Y value was passed to the function)

Any thoughts?

-

## closed as off-topic by Kuba, Louis, m_goldberg, Michael E2, MarcoBNov 14 '15 at 15:42

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – m_goldberg, Michael E2, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

your code is incomplete. please post code that we can cut and paste into a notebook and evaluate and reproduce what you see. otherwise you may not get any help. – Mike Honeychurch Jul 15 '14 at 23:36
I'm voting to close this question as off-topic because it's abandoned and too localized. – Kuba Nov 14 '15 at 9:26