PDA

View Full Version : [CLOSED] NumberField Arrows KeyPress



softmachine2011
Jul 12, 2012, 11:34 AM
Hi,

With this code I avoid to show spinup and spindown buttons. But pressing up or down arrow numberfield change it's value with marked step.


<ext:NumberField ID="txtValor" runat="server" FieldLabel="Some TExt" Step="2"
Width="140" Hidden="true" LabelAlign="Top" AllowDecimals="false" MinValue="0" HideTrigger="true" />


I think it is another bug.

Vladimir
Jul 12, 2012, 12:16 PM
It is not bug, you have to set ReadOnly="true" to prevent chages (please note that ReadOnly option will hide trigger buttons automatically)

softmachine2011
Jul 12, 2012, 12:35 PM
It is not bug, you have to set ReadOnly="true" to prevent chages (please note that ReadOnly option will hide trigger buttons automatically)

Yes I know that readonly avoids user to write in field.
But with the code that I indicate, you can write in the field and keymaps linked to spinner are working yet.

I think that if I disable the trigger with HideTrigger="true", keymaps linked to spinner has to be disabled too.

Vladimir
Jul 12, 2012, 12:42 PM
No, KeyMap should not be disabled automatically (it is very strange if KeyMap will be disabled if triggers are hidden).
If you need such behaviour then you have to disable KeyMap manually (ReadOnly option is best option in this case)

Vladimir
Jul 12, 2012, 12:45 PM
Just to clarify, Triggers and KeyMap are various ways to change a value
If you disable one way then it doesn't mean that another way should not work

Therefore if you don't need any changes then you have to set ReadOnly (which blocks user input)

softmachine2011
Jul 12, 2012, 12:46 PM
Yes but with readonly, user cannot write in the field.

I will analize if it is really an issue for me. But I think it is an strange behaviour.

Vladimir
Jul 12, 2012, 12:52 PM
You can set KeyNavEnabled="false" for the field

softmachine2011
Jul 12, 2012, 12:58 PM
Ok it works like expected with it.

Thanks, I didn't know this property

Vladimir
Jul 12, 2012, 1:05 PM
No problem,

You can always investigate ExtJS docs to undesrtand possible properties
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Spinner