I make a function name as IncrementInputFieldsCreation.
(*Option*)
Options[IncrementInputFieldsCreation]:={partion->All,rowsInputFields-> 1};
(*Defination*)
IncrementInputFieldsCreation[noOfInputFields_,OptionsPattern[]]:=
(
Module[{inputvaluelist=Null},
(*it checks wheather noOfInputFields value is 0 or not*)
If[
(noOfInputFields>0),
(*If noOfInputFields value is greater than 0*)
(inputvaluelist=Table[0,{noOfInputFields},{OptionValue[rowsInputFields]}];
(*output*)
output={
Table[
(
With[{i=i,j=j},
(Row[{
Column[{
MouseAppearance[
EventHandler[
Style["\[FilledUpTriangle]",Bold,Black,{15,15}],
{"MouseClicked":>(inputvaluelist[[i,j]]=inputvaluelist[[i,j]]+1)}
],
"LinkHand"
],
MouseAppearance[
EventHandler[
Style["\[FilledDownTriangle]",Bold,Black,{15,15}],(*Button Next to InputField For Decrement *)
{"MouseClicked":>(If[
(inputvaluelist[[i,j]]>0),
(inputvaluelist[[i,j]]=inputvaluelist[[i,j]]-1),
(inputvaluelist[[i,j]]=0)
]
)
}
],
"LinkHand"
]
},
Spacings->0,
Alignment->Center,
Background->RGBColor[0.65,0.65,0.65]
],
InputField[
Dynamic[inputvaluelist[[i,j]]],
Number,
ContinuousAction->True,
ImageSize->{50,20},
Alignment->Center
]
}](*Row is closed here*)
)
]
(*with is closed*)
),
{i,1,Length[inputvaluelist]},
{j,1,Length[Part[inputvaluelist,i]]}
],(*Table closed*)
Dynamic[inputvaluelist]
};
Part[output,OptionValue[partion]]
),
("")
](*If Closed here*)
](*Module closed*)
)
case1:
IncrementInputFields`IncrementInputFieldsCreation[3,rowsInputFields -> 4]
If you call that function in the above way,we will get list of InputFields and InputFieldValues.
and also if you can click on upArrowbutton (beside of the InputField) the value of the InputField will be increased like that in opposite way downArrowbutton will work..
case2:
value = 1;
{PopupMenu[Dynamic[value], Range[6]],
Dynamic[IncrementInputFields`IncrementInputFieldsCreation[value,
rowsInputFields -> 4]]}
in case2, dynamically we will get list of InputFields and InputFieldValuesdepending upon the PopupMenu value.
but problem is,dynamically the upArrow,downArrow buttons are not working...
I think in case2,dynamically function is evaluated everytime so because of that it's not working..
how can I overcome this?
Setting? – PlatoManiac Jan 22 at 18:21Setting? – subbu Jan 22 at 18:27Dynamicvariable. In your above code why dont you useDynamicModulein place ofModule? – PlatoManiac Jan 22 at 18:32DynamicModulealso ,still not get it.. – subbu Jan 22 at 18:37ModuletoDynamicModuleand remove the context nameIncrementInputFieldsfrom the function name you get something that works as expected in Version 9 (MS Vista 64bit). – kguler Jan 22 at 19:55