×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    5

    nokia sets doesn't allow editing textfield

    Hi,
    I ve the following code which is running well on emulators (wtk)
    symbol = new TextField("Symbol","",20,TextField.ANY ) ;
    price = new TextField("Price ","",20,TextField.DECIMAL ) ;
    this.setItemStateListener(this) ;

    public void itemStateChanged(Item item){
    /* equalStrings my own written method which is implementation
    of equalIqnorCase of String class because in CLDC1.0 equalIqnoreCase is not available*/
    if(this.equalSrings(item.getLabel(),"Symbol" ) )
    {
    setPrice();
    }
    }

    public void setPrice()
    {
    String temp = symbol.getString() ;
    for (int i=0 ; i < symbols.length ; i++ ) {
    if(symbols == null)
    {
    continue;
    }
    if(this.equalStrings(symbols.toString() ,temp) )
    {
    price.setString(prices.toString());

    }
    }
    }
    This is very straight forward code where symbol array contains symbols and if something entered in symbol text field match with any of these symbols its price from price array pop up in price text field
    Now it works fine on emulator but when it deployed it on any nokia set
    the last character of symbol does not appear although event fired and price is set in price field
    so i entered a line in setPrice() method
    symbol.setString(symbols );
    now symbol is displayed in symbol field but it becomes uneditable in nokia sets . It is working fine in Sony/Erricson sets and emulator(wtk)
    can any one tell me what is the problem ?????

  2. #2
    Nokia Developer Champion
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,192

    Re: nokia sets doesn't allow editing textfield

    You seem to be using CLDC 1.0 device (which one?) as you mentioned implementing some methods missing from CLDC 1.0. There is no support for floating point numbers in CLDC devices and possibly TextField.DECIMAL does not work properly on those devices (even if they might support MIDP2). Are you building the app also for CLDC 1.0 devices (you have to select a CLDC 1.0 specific option in WTK)? Have you tried using some other TextField constraing on the problemtaic field?

    Hartti

  3. #3
    Regular Contributor
    Join Date
    Mar 2005
    Posts
    249

    Re: nokia sets doesn't allow editing textfield

    Imo, it has nothing to do with TextField.DECIMAL as it is a problem with the the other textfield.

    When you say symbol, are they normal letters of the alphabet (eg. arb) or are they actually symbols (eg. $ % ^)? Also, which nokia handsets are you testing on? S60?

    Also, in the for loop below, you forgot to add the [i] and instead reffered to the main array itself.

    Code:
    symbol = new TextField("Symbol","",20,TextField.ANY );
    price = new TextField("Price ","",20,TextField.DECIMAL );
    this.setItemStateListener(this) ;
    
    public void itemStateChanged(Item item){
     if(this.equalStrings(item.getLabel(),"Symbol" ) ) {
       setPrice();
     }
    }
    
    public void setPrice(){
     String temp = symbol.getString() ;
     for (int i=0 ; i < symbols.length ; i++ ) {
       if(symbols[i] == null) {
        continue;
       }
       if(this.equalStrings(symbols[i].toString() ,temp) ) {
        price.setString(prices.toString());
       }
     }
    }

  4. #4
    Regular Contributor
    Join Date
    Mar 2005
    Posts
    249

    Re: nokia sets doesn't allow editing textfield

    PS: I just realized...

    so i entered a line in setPrice() method
    symbol.setString(symbols );
    If the above wasn't a typo, perhaps doing this will solve your problem:
    symbol.setString(symbols[i]);

  5. #5
    Registered User
    Join Date
    Apr 2006
    Posts
    5

    Re: nokia sets doesn't allow editing textfield

    Thanx all 4 replying

    Actually this wasnt the prob which u guys pointed

    Actually i ve used symbols[i] istead of price[i] instead of price

    the problem was with event handling . I ve solved the prob so

    here i m trying to explain it
    when we press any key and focus was on symbol text field "setPrice()"
    called and once it set the price it was setting symbol in symbol field too
    Remember due to last character missing prob (i ve mentioned in prob.). but
    once it set the symbol field and v try to edit it again event occured causing
    call to setPrice () again
    so know i ve understand it and i ll solve it thanx

    Any one with the idea why last character was missing when i write in symbol field for example if the symbol is "PTC" when i write PTC in symbol field its price lets say 64.25 is set in price field but symbol field shows "PT" instead of "PTC"

Similar Threads

  1. Nokia 2115i Firmware
    By bmuser in forum General Development Questions
    Replies: 3
    Last Post: 2007-10-09, 08:35
  2. SMS and Nokia phones
    By rudolphous in forum Mobile Java General
    Replies: 4
    Last Post: 2003-08-04, 08:50
  3. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •