0
$\begingroup$

I would like to create a dialog like the one in the picture:

enter image description here

where by default:

  • the content of $x_1$, $y_1$, $F_{x1}$, $F_{x2}$, $M_{z1}$ is $0$;
  • the content of $\theta_{e1}$ is disabled;
  • the tips are all on "Free";

while if at least one tip is "Bounded" then $\theta_{e1}$ is also enabled.

Finally, once I clicked "OK" I would like the window to disappear.

Would someone kindly show me how to do it? Even though I've read the guide, I can not compose such a complex dialog.


In particular, writing:

DialogInput[

 DialogNotebook[{

   TextCell["Node 1", Bold, FontSize -> 20],

   Grid[{

     {TextCell["x1 ="], 
      InputField[Dynamic[x1], String, ImageSize -> {50, 15}],
      TextCell["m    y1 ="], 
      InputField[Dynamic[y1], String, ImageSize -> {50, 15}],
      TextCell["m    \[Theta]e1 ="], 
      InputField[Dynamic[\[Theta]e1], String, ImageSize -> {50, 15}], 
      TextCell["\[Degree]"]},

     {TextCell[""]},

     {TextCell["Fx1 ="], 
      InputField[Dynamic[Fx], String, ImageSize -> {50, 15}],
      TextCell["kN   Free"], Checkbox[Dynamic[Fx1]],
      TextCell["Fix"], Checkbox[Dynamic[Fx2]],
      TextCell["Spring"], Checkbox[Dynamic[Fx3]]},

     {TextCell[""]},

     {TextCell["Fy1 ="], 
      InputField[Dynamic[Fy], String, ImageSize -> {50, 15}],
      TextCell["kN   Free"], Checkbox[Dynamic[Fy1]],
      TextCell["Fix"], Checkbox[Dynamic[Fy2]],
      TextCell["Spring"], Checkbox[Dynamic[Fy3]]},

     {TextCell[""]},

     {TextCell["Mz1 ="], 
      InputField[Dynamic[Mz], String, ImageSize -> {50, 15}],
      TextCell["kN\[CenterDot]m  Free"], Checkbox[Dynamic[Mz1]],
      TextCell["Fix"], Checkbox[Dynamic[Mz2]],
      TextCell["Spring"], Checkbox[Dynamic[Mz3]]}

     }],

   Button["OK",
          DialogReturn[],
          Alignment -> Center,
          ImageSize -> {450, 30}]
   }]]

I get:

enter image description here

which should be improved already on a graphical level, since I would like a more compact window.

Obviously then the important things are other:

  • by default there is zero written in Fx1, Fy1 and Mz1;

  • difault the check-ups are all on Free and in this case the angle box and all the other check-outs are disabled;

  • if the check on one line is made on one option, the other two are disabled.

These, for now, are the salient things I'd like to get. Then this mask would like to save it in a form so that it can be called within some for loops, but this is something that should be considered later.

Can someone give me a hand? Thank you!

$\endgroup$
  • 1
    $\begingroup$ Have you been able to compose a simpler dialog? If so please show were you are and where you got stuck. $\endgroup$ – bill s Dec 16 '17 at 18:32
  • 1
    $\begingroup$ Nested Grid will be your friend here. Then use the variable binding provided in the first argument of DialogInput. $\endgroup$ – b3m2a1 Dec 16 '17 at 20:00
  • 1
    $\begingroup$ There are probably several examples of building dialogs on this site that are relevant to your problem. This answer, which I posted earlier thus year, may be one. $\endgroup$ – m_goldberg Dec 17 '17 at 0:45
  • $\begingroup$ Thanks for your help. As you advised, above I reported what I produced, now I would need more advice to continue. Thanks again! $\endgroup$ – TeM Dec 17 '17 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.