summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2010-05-27 20:18:21 +0300
committerYuri Chebotarev <ychebotarev@productengine.com>2010-05-27 20:18:21 +0300
commita83ec740e4856b3575b66e51cfe83470928ad7e5 (patch)
tree25e4b1f90ac03ed3bac02f007410dc2955782cbe /indra/llui
parenta0351c6ea4446bfa8fc85450c2603251cd703c2c (diff)
EXT-7231 FIX if precision is "0" set validation function to validateNonNegativeS32
reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/451/ --HG-- branch : product-engine
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llspinctrl.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index b47f21ed8a..c0d02fa8e9 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -127,7 +127,16 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p)
}
params.max_length_bytes(MAX_STRING_LENGTH);
params.commit_callback.function((boost::bind(&LLSpinCtrl::onEditorCommit, this, _2)));
- params.prevalidate_callback(&LLTextValidate::validateFloat);
+
+ if( mPrecision>0 )//should accept float numbers
+ {
+ params.prevalidate_callback(&LLTextValidate::validateFloat);
+ }
+ else //should accept int numbers
+ {
+ params.prevalidate_callback(&LLTextValidate::validateNonNegativeS32);
+ }
+
params.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM);
mEditor = LLUICtrlFactory::create<LLLineEditor> (params);
mEditor->setFocusReceivedCallback( boost::bind(&LLSpinCtrl::onEditorGainFocus, _1, this ));