aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llspinctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llui/llspinctrl.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/linden/indra/llui/llspinctrl.cpp b/linden/indra/llui/llspinctrl.cpp
index a106af4..b12d095 100644
--- a/linden/indra/llui/llspinctrl.cpp
+++ b/linden/indra/llui/llspinctrl.cpp
@@ -49,7 +49,7 @@
49#include "llfocusmgr.h" 49#include "llfocusmgr.h"
50#include "llresmgr.h" 50#include "llresmgr.h"
51 51
52const U32 MAX_STRING_LENGTH = 32; 52const U32 MAX_STRING_LENGTH = 255;
53 53
54static LLRegisterWidget<LLSpinCtrl> r2("spinner"); 54static LLRegisterWidget<LLSpinCtrl> r2("spinner");
55 55
@@ -123,7 +123,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
123 mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font, 123 mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font,
124 MAX_STRING_LENGTH, 124 MAX_STRING_LENGTH,
125 &LLSpinCtrl::onEditorCommit, NULL, NULL, this, 125 &LLSpinCtrl::onEditorCommit, NULL, NULL, this,
126 &LLLineEditor::prevalidateFloat ); 126 &LLLineEditor::prevalidateASCII );
127 mEditor->setFollowsLeft(); 127 mEditor->setFollowsLeft();
128 mEditor->setFollowsBottom(); 128 mEditor->setFollowsBottom();
129 mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this ); 129 mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this );
@@ -132,6 +132,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
132 // it's easier to understand 132 // it's easier to understand
133 //mEditor->setSelectAllonFocusReceived(TRUE); 133 //mEditor->setSelectAllonFocusReceived(TRUE);
134 mEditor->setIgnoreTab(TRUE); 134 mEditor->setIgnoreTab(TRUE);
135 mEditor->setSelectAllonCommit(FALSE);
135 addChild(mEditor); 136 addChild(mEditor);
136 137
137 updateEditor(); 138 updateEditor();
@@ -292,9 +293,10 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
292 LLSpinCtrl* self = (LLSpinCtrl*) userdata; 293 LLSpinCtrl* self = (LLSpinCtrl*) userdata;
293 llassert( caller == self->mEditor ); 294 llassert( caller == self->mEditor );
294 295
295 std::string text = self->mEditor->getText(); 296 if( self->mEditor->evaluateFloat() )
296 if( LLLineEditor::postvalidateFloat( text ) )
297 { 297 {
298 std::string text = self->mEditor->getText();
299
298 LLLocale locale(LLLocale::USER_LOCALE); 300 LLLocale locale(LLLocale::USER_LOCALE);
299 F32 val = (F32) atof(text.c_str()); 301 F32 val = (F32) atof(text.c_str());
300 302
@@ -322,9 +324,12 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
322 success = TRUE; 324 success = TRUE;
323 } 325 }
324 } 326 }
325 self->updateEditor();
326 327
327 if( !success ) 328 if( success )
329 {
330 self->updateEditor();
331 }
332 else
328 { 333 {
329 self->reportInvalidData(); 334 self->reportInvalidData();
330 } 335 }