0

I am having a couple of problems with my SpinnerField in GXT 2.0. First it is showing doubles when the user changes 1.0,2.0 I need it to show Ints 1,2,3 etc.

Second, for the life of me I cannot figure out how to add a change listener to it. Like user makes a change it pops up an alert with the value: just for demonstration purposes.

I have looked through the documentation but cannot find the answer.

james
  • 2,595
  • 9
  • 43
  • 70

2 Answers2

0

try adding this to spinner field :

spinner.setFormat(NumberFormat.getFormat("0"));
spinner.addListener(Events.KeyPress, new KeyListener() {...});
spinner.addListener(Events.Change, new Listener<BaseEvent>(){...});
orrexian
  • 24
  • 2
0

I will add:

maxNumberMsgField = new SpinnerField(); maxNumberMsgField.setFieldLabel(FeedbackAuthoringStrings.MAX_NUM_MSGS_PROV_LABEL); maxNumberMsgField.setIncrement(1);
maxNumberMsgField.getPropertyEditor().setType(Integer.class); maxNumberMsgField.getPropertyEditor().setFormat(NumberFormat.getDecimalFormat());
maxNumberMsgField.setMinValue(1);
maxNumberMsgField.setMaxValue(20);

anahuacv
  • 21
  • 2