Message Boards Message Boards

5 Replies
0 Total Likes
View groups...
Share this post:

school - how to make a "button" with parenthesis

Posted 9 years ago

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}, 
      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}}}}]]

    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]]
POSTED BY: martin martin
5 Replies

thank you :)

POSTED BY: martin martin

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},

    Column[Table[With[{i = i}, Button[ToString[i], x = i]], {i, 1, 4}]]
POSTED BY: David Reiss

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 BY: martin martin

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 BY: David Reiss
POSTED BY: martin martin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract