0
|
11380 Views
|
3 Replies
|
3 Total Likes
View groups...
Share

# how to make the following graphical interface?

Posted 9 years ago
 Hello all, I write in this forum because I have many doubts as to make the following graphical interface, my idea is to do something like the following: and that as input parameters are the first number and second number order to operate on them subsequently. The problem is that it is not how to bind the boxes with the button to make the operation brought. I have done pieces of code for such an idea but without any results, here is what I have done a=InputFiled[ ]; b=Inputfield[ ]; Button["Calculate",Print[Plus[a,b] CheckboxBar[{1}, {1 -> "Plus", 2 -> "Subtract", 3 -> "Times",4-> "Division"}]  I hope that somebody can say me how to make my idea reality because it is the first time that I am doing this in Mathematica and and am having many problems. Thanks in advance.
3 Replies
Sort By:
Posted 9 years ago
 Many thanks for your help Gustavo to solve my problem, I've tested the code and it works very well, excuse my ignorance but it is possible to do the same with "checkboxbar" because I do not work with this command, that command is used for anything else? Thanks a lot again.
Posted 9 years ago
 Try something like CheckboxBar[Dynamic[x, (x = #[[{-1}]]) &], Range@5] but now here the result is a list so you should take x[] before applying it.
Posted 9 years ago
 Many ways to do it. This is one: DynamicModule[{f = Plus, a = 1, b = 1, c = 2}, Column[ {RadioButtonBar[Dynamic[f], {Plus, Subtract, Times, Divide}], Grid[ {{InputField[Dynamic[a]], "First Number"}, {InputField[Dynamic[b]], "Second Number"}, {InputField[Dynamic[c], Enabled -> False], "Result"}}], Button["Calculate", c = f[a, b]]}]] Buena suerte!