# school - how to make a "button" with parenthesis

Posted 9 years ago
3003 Views
|
5 Replies
|
0 Total Likes
|
 Hello, I have a school subject Mathematica. I have this code. Could I ask, how do I make the numbers? The numbers will be written into the frame A. Thank you for the advice :) DynamicModule[{a = 0, b = 0}, Deploy[Style[ Panel[Grid[ Transpose[{{Style["A", Red], Style["B", Red], "here is their sum", "their difference", "their product"}, {InputField[Dynamic[a], Number], InputField[Dynamic[b], Number], InputField[Dynamic[a + b], Enabled -> False], InputField[Dynamic[a - b], Enabled -> False], InputField[Dynamic[a b], Enabled -> False]}}], Alignment -> Right], ImageMargins -> 10], DefaultOptions -> {InputField -> {ContinuousAction -> True, FieldSize -> {{5, 30}, {1, Infinity}}}}]] Row@Prepend[ Table[With[{b = b}, Button[b, predpisFce = predpisFce <> b, Alignment -> Center, Appearance -> "Pressed"]], {b, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}}], Style["Cisla ", Italic, Bold]] ]  Attachments:
5 Replies
Sort By:
Posted 9 years ago
 thank you :)
Posted 9 years ago
 Something like this certainly requires that you know how to program in Mathematica ;-). You say that you downloaded this code from somewhere, or did you write it yourself? As I understand it, you want to press on a button and have a value appear in an input field.Here is a simple example of an input field and a button that puts a value into that input field. Perhaps this can give you a start in figuring out this problem. DynamicModule[{x = 0}, Panel@Column[{ InputField[Dynamic[x]], Column[Table[With[{i = i}, Button[ToString[i], x = i]], {i, 1, 4}]] } ] ] 
Posted 9 years ago
 I downloaded a couple of hours in the school commands. "predpisFce 's got nothing to do. But I do not know how to do: Press the "1-9" and appear to me to frame A. That is my problem. I do not know how to program :(
Posted 9 years ago
 I am not sure what your row of buttons is supposed to do since predpisFce is not defined and does not appear anywhere other than in the button and it is not initialized as a local variable in the DynamicModule.
Posted 9 years ago
 My biggest problem is how to modify (write) this part Row@Prepend[ Table[With[{b = b}, Button[b, predpisFce = predpisFce <> b, Alignment -> Center, Appearance -> "Pressed"]], {b, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}}], Style["Cisla ", Italic, Bold]]