Threaded View

  1. #1
    Sencha User ITS_luka's Avatar
    Join Date
    Aug 2011
    Location
    Tbilisi, Georgia
    Posts
    19
    Vote Rating
    0
    ITS_luka is on a distinguished road

      0  

    Default Answered: About TextField

    Answered: About TextField


    Hello,

    onKeyPress, textfield must change character

    e.g. when i press 'a' on my keyboard, i want my textfield type 'პ'-symbol instead.

    I know unicodeCharCodes of my sybmols. (from \u4304 to \u4336)

    how to do that?

    thank you

  2. Ah. It wasn't clear where you were at in your development. This works nicely, if however unreasonably specific. The key is event.preventDefault() since you don't want the original character rendering, without this line, both characters will render:

    Code:
    public class TextFieldKeyPressTest implements EntryPoint
    {
       @Override
       public void onModuleLoad()
       {
          ContentPanel cp = new ContentPanel();
          cp.setPixelSize(400, 400);
    
          final TextField tf = new TextField();
          tf.addKeyPressHandler(new KeyPressHandler()
          {
             @Override
             public void onKeyPress(KeyPressEvent event)
             {
                event.preventDefault();
                char val = event.getCharCode();
                char swapChar = val;
                String current = tf.getText();
                if (val == 'a')
                {
                   swapChar = '\u00E4';
                }
    
                tf.setText(current + swapChar);
             }
          });
          cp.setWidget(tf);
    
          RootPanel.get().add(cp);
       }
    }

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi