Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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_]:=
    yButton[initialX_,initialZ_, coneBase_,coneHeight_]:=
        checkInitialXInitialY[initialX, initialZ, coneBase, coneHeight]
    zButton[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_] :=
    inputColumnTitle[{"Intersection of centerline of cylinder and cone"}],
    inputField[initialX, initialXInputProperties],
    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?

share|improve this 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.