I'm pretty new to mathematica and I'd like to create a little program that takes user input as variables which it then uses to do some calculations. I have the following code:
Clear[numcols, nullbitmap]
DynamicModule[{numcols, nullbitmap},
Column[{
InputField[Dynamic[numcols], Number,
FieldSize -> {15, {1, Infinity}}],
Button[Style["Process"],
nullbitmap[numcols_] = 2 + ((7 + numcols)/8)]
}]]
Print[nullbitmap]
But this doesn't print the result I and it seems that it doesn't take the 'numcols' as a variable in the calculation.
nullbitmap[numcols_] = 2 + ((7 + numcols)/8)]
looks at least confusing replaced byPrint[2 + ((7 + numcols)/8)]
should do what you need. I'm encouraging you to go through documentation ofDynamicModule
,InputField
,Button
, especially basic examples and applications sections. $\endgroup$