Great that it helped you.

You can try luck with the many select functions of QxTextField. Maybe it 
is possible to move the cursor with these methods, too.

Sebastian


Thi Nguyen schrieb:
> Hi Sebastion,
>  
> Thank you so much for the work around. I used suggestion #1 and it works.
>  
>  >> yourTextField.forceValue(null);
>  >>yourTextField.setValue(fixedValue);
>  
> Another problem is though it works, the cursor get reset to the 
> beginning of the string. How can I set it to end of the new string.
>  
> Many thanks for looking into this problem.
>  
> th_java
>  
> ---------------------------------------------------------------------------
>  
> Hi Sebastian,
>    
>    >>Why do you need this:
>  >>QxWidget.flushGlobalQueues();
>    
>    This was done out of desperation !!! I was trying to force an update 
> and follow the
> suggestion as documented in the code snippets section under the heading 
> "forcing an update"
> http://old.qooxdoo.org/snippets/forcing-an-update
>    
>    I could not solve the problem with my numeric QXTextField . After 
> several tests were done
> it seems that the regular expression works correctly, the 
> valueField.setValue() works
> correctly. Only the value being displayed is not correct.
>    
>    What being displayed on the console is computedValue ... i think.
>    
>    Please find below the code snippets and the output for eacg test cases:
>    
>    Thank you again for your help.
>    
>    
>    -----------------------------------------------------------------
>    var valueField = new QxTextField();
>    
>    valueField.addEventListener("input", function(e) {
>   
>       var text = e.getData();
>   
>       var re = /[^\d]/g;
>   
>       var newText = text.replace(re,"");
>   
>   
>    
>       if (newText == ""){
>          alert ("match is empty string" );
>          valueField.setValue("")
>       }
>       else {
>          valueField.setValue(newText);
>       }
>      alert( e.getData());
>   
>      alert( valueField.getComputedValue());
>      alert(valueField.getValue());
>    
>   
>   
>   
>    }, valueField
>    
>    ------------------------------------------------
>    Test results:
>    
>    1. Enter "a" ( e.getData() = "a")
>    e.getData() = "a"
> valueField.getComputedValue() = ""
> valueField.getValue() = ""
>    Display on console: "" (as expected)
>   
> 2. Enter "b" ( e.getData() = "b")
>    e.getData() = "b"
> valueField.getComputedValue() = "b"
> valueField.getValue() = ""
>    Display on console: "b"
>   
> 3. Enter "2" next to "b" ( e.getData() = "b2")
>    e.getData() = "b2"
> valueField.getComputedValue() = "2"
> valueField.getValue() = "2"
>    Display on console: "2" (as expected)
>    
>    4. Enter "c" next to 2 (e.getData() = "2c")
>    valueField.getComputedValue() = "2c"
> e.getData() = "2c"
> valueField.getValue() = "2"
>    Display on console: "2c"
>    
>    ----------------------------------------------------------------
>    
>    Hi Thi!
>  
>   Why do you need this:
>   QxWidget.flushGlobalQueues();
>  
>   Makes IMHO no sense.
>  
>   If "match" is really null this is an invalid value. You should normalize
>   it to a empty string.
>  
>   textfields are always selectable by default. So there is no need to
>   manually do: valueField.setSelectable(true)
>  
>   The drag and drop in select fields does not work, because we need to
>   prohibit the default drag and drop handling to be sure that qooxdoo's
>   built-in drag&drop handling work stable.
>  
>   Hope this helps.
>  
>   Sebastian
>  
>  
>   Thi Nguyen schrieb:
>   > Hi,
>   > 
>   > I am trying to create a text field that only takes numeric by using a
>   > regular expression to replace anything that is not a digit with null.
>   > The regular expression works. However, the QxTextFiled.setValue() does
>   > not seem to worl all the way.
>   > 
>   > 1. If the value entered is 1a2 then the value being displayed is "12".
>   > However, if the value is "abc" then the display value is "abc"
>   > eventhough "match" is null.
>   > 
>   > 2. Also, with "valueField.setSelectable(true)", I can select a text
>   > field with double click but can not just drag and select.
>   > 
>   > Please help me to see what I have done wrong. Here is the codesnipets.
>   > 
>   > Thank you very much in advance.
>   > 
>   > 
>   > var valueField = null;
>   > valueField = new QxTextField(value);
>   >  valueField.setSelectable(true);
>   >           
>   >  valueField.addEventListener("input", function(e) {
>   >                            
>   >      var re = /[^\d]/g       
>   >       var text = e.getData();
>   >       var match = text.replace(re,"");
>   >                              
>   >        valueField.setValue(match);
>   >        QxWidget.flushGlobalQueues();
>   >                         
>   >     }, this );
>   > 
>   > th_java
>   >
>   > 
> 
> 
>   Send instant messages to your online friends 
> http://au.messenger.yahoo.com <http://au.messenger.yahoo.com/>
> 
> 
> 
> 
>       From: Sebastian Werner <[EMAIL PROTECTED]>
>       * Re: Numeric Text Field*
>       <http://sourceforge.net/mailarchive/message.php?msg_id=19041313>  
>       2006-06-13 23:12
> 
>        Hi Thi,      just one idea:      As all properties in qooxdoo does a 
> compare of the old and the new    value, it may be possible that through the 
> fixing of the incoming value,    that the stored value is already the same 
> than the fixed value. Then the    value wouldn't be re-applied to the 
> text-field. Maybe we should    introduce properties, which don't use this 
> feature. It would be great    you could add a comment to this bug:      
> http://bugzilla.qooxdoo.org/show_bug.cgi?id=16      You can work-around your 
> issue by doing one of the following:      #1   
> yourTextField.forceValue(null);   yourTextField.setValue(fixedValue);      #2 
>   yourTextField.setValue(fixedValue);   
> yourTextField.setHtmlProperty("value", fixedValue);      Both are possible 
> and should work. I would prefer
>        solution #1.      Hope this helps.      Sebastian               Thi 
> Nguyen schrieb:   > Hi Sebastian,   >     >  >>Why do you need this:   >  
> >>QxWidget.flushGlobalQueues();   >     > This was done out of desperation 
> !!! I was trying to force an update and    > follow the suggestion as 
> documented in the code snippets section under    > the heading "forcing an 
> update"    > http://old.qooxdoo.org/snippets/forcing-an-update   >     > I 
> could not solve the problem with my numeric QXTextField . After    > several 
> tests were done it seems that the regular expression works    > correctly, 
> the valueField.setValue() works correctly. Only the value    > being 
> displayed is not correct.   >     > What being displayed on the console is 
> computedValue ... i think.   >     > Please find below the code snippets and 
> the
>        output for eacg test cases:   >     > Thank you again for your help.   
> >     >     > 
> -----------------------------------------------------------------   > var 
> valueField = new QxTextField();   >     > 
> valueField.addEventListener("input", function(e) {   >    var text = 
> e.getData();   >    var re = /[^\d]/g;   >    var newText = 
> text.replace(re,"");   >     >    if (newText == ""){   >       alert ("match 
> is empty string" );   >       valueField.setValue("")   >    }   >    else {  
>  >       valueField.setValue(newText);   >    }   >   alert( e.getData());   
> >   alert( valueField.getComputedValue());   >   
> alert(valueField.getValue());   >     > }, valueField   >     > 
> ------------------------------------------------   > Test results:   >     > 
> 1. Enter "a" ( e.getData() = "a")   > e.getData() = "a"   > 
> valueField.getComputedValue() = ""   > valueField.getValue() = ""   >
>        Display on console: "" (as expected)   >    > 2. Enter "b" ( 
> e.getData() = "b")   > e.getData() = "b"   > valueField.getComputedValue() = 
> "b"   > valueField.getValue() = ""   > Display on console: "b"   >    > 3. 
> Enter "2" next to "b" ( e.getData() = "b2")   > e.getData() = "b2"   > 
> valueField.getComputedValue() = "2"   > valueField.getValue() = "2"   > 
> Display on console: "2" (as expected)   >     > 4. Enter "c" next to 2 
> (e.getData() = "2c")   > valueField.getComputedValue() = "2c"   > e.getData() 
> = "2c"   > valueField.getValue() = "2"   > Display on console: "2c"   >     > 
> ----------------------------------------------------------------   >     > Hi 
> Thi!   >    > Why do you need this:   > QxWidget.flushGlobalQueues();   >    
> > Makes IMHO no sense.   >    > If "match" is really null this is an invalid 
> value. You should normalize   > it to a empty string.   >    > textfields
>        are always selectable by default. So there is no need to   > manually 
> do: valueField.setSelectable(true)   >    > The drag and drop in select 
> fields does not work, because we need to   > prohibit the default drag and 
> drop handling to be sure that qooxdoo's   > built-in drag&drop handling work 
> stable.   >    > Hope this helps.   >    > Sebastian   >    >    > Thi Nguyen 
> schrieb:   >  > Hi,   >  >    >  > I am trying to create a text field that 
> only takes numeric by using a   >  > regular expression to replace anything 
> that is not a digit with null.   >  > The regular expression works. However, 
> the QxTextFiled.setValue() does   >  > not seem to worl all the way.   >  >   
>  >  > 1. If the value entered is 1a2 then the value being displayed is "12".  
>  >  > However, if the value is "abc" then the display value is "abc"   >  > 
> eventhough "match" is null.   >  >    >  >
>        2. Also, with "valueField.setSelectable(true)", I can select a text   
> >  > field with double click but can not just drag and select.   >  >    >  > 
> Please help me to see what I have done wrong. Here is the codesnipets.   >  > 
>    >  > Thank you very much in advance.   >  >    >  >    >  > var valueField 
> = null;   >  > valueField = new QxTextField(value);   >  >  
> valueField.setSelectable(true);   >  >              >  >  
> valueField.addEventListener("input", function(e) {   >  >                     
>           >  >      var re = /[^\d]/g          >  >       var text = 
> e.getData();   >  >       var match = text.replace(re,"");   >  >             
>                     >  >        valueField.setValue(match);   >  >        
> QxWidget.flushGlobalQueues();   >  >                            >  >     }, 
> this );   >  >    >  > th_java   >  >   > 
>        >    >    > Send instant messages to your online friends 
> http://au.messenger.yahoo.com <http://au.messenger.yahoo.com/>   >    >    > 
> ------------------------------------------------------------------------   >  
>   > _______________________________________________   > Qooxdoo-devel mailing 
> list   > [EMAIL PROTECTED]   > 
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel     
> 
>            
> 
> 
> Send instant messages to your online friends http://au.messenger.yahoo.com
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to