×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    4

    TextBox caret position

    hello everyone,
    I am trying to develop a sample j2me app. I have used a TextBox and tried to set its string using textBox.setString("test") . What i have noticed that the cursor keeps its position at index 0 (first t letter) of the string when i tested it in Nokia E61i . Is there anyway to set the caret position of the the TextBox to a specific position ??????
    help me please.
    Thanks,

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: TextBox caret position

    This is not supported by default TextBox of MIDP, so you will require to write your own TextBox component extending the CustomItem provided by MIDP and implement this feature (ref to http://wiki.forum.nokia.com/index.ph...put_in_Java_ME )... or Try using any UI lib's like LWUIT.
    Thanks,
    Ekta

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    80

    Re: TextBox caret position

    Just make a small trick. insert a free string at the end of the textbox.

    PHP Code:

    textBox
    .insert(""textBox.getString().length()); 
    It will set the cursor to the end of the text

  4. #4
    Registered User
    Join Date
    Apr 2010
    Posts
    80

    Re: TextBox caret position

    In Nokia, The trick must be extended. Otherwise, It is useless.

    PHP Code:

    String temp 
    textBox.getString();
    textBox.setString("");
    textBox.insert(temptemp.length());
    textBox.setString(temp); 

Similar Threads

  1. How to catch caret-Key
    By griffin27 in forum Qt
    Replies: 5
    Last Post: 2010-03-23, 09:27
  2. help-textbox
    By abimatrix in forum Symbian
    Replies: 0
    Last Post: 2007-02-18, 06:42
  3. textbox
    By palak_shah_23 in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2006-05-29, 12:53
  4. TextBox
    By seregindv in forum Mobile Java General
    Replies: 6
    Last Post: 2005-04-19, 16:35
  5. Cursor position in TextBox
    By luemkemann in forum Mobile Java General
    Replies: 0
    Last Post: 2003-04-10, 09:33

Posting Permissions

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