×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    45

    How to focus on a specified item?

    I want to focus on a TextField every time I show a Form.Did anyone know how?

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: How to focus on a specified item?

    should be able to use form.setselected(item) or is it item.setSelected, note, this is only MIDP 2.0
    Jason Glass
    http://IChiBanComputers.Com

  3. #3
    Registered User
    Join Date
    Dec 2005
    Location
    Brazil
    Posts
    1,884

    Re: How to focus on a specified item?

    It seems it's not possible to set focus, right?

  4. #4
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: How to focus on a specified item?

    we were using setselected, which from a MS standpoint, is similar to setfocus

    but had to remove it, or put in preprocessor statements, for doing MIDP 1.0 builds as it was not supported.

    I think it works?
    Jason Glass
    http://IChiBanComputers.Com

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    45

    Re: How to focus on a specified item?

    Sorry,I don't find a any method similar to setSelected.

  6. #6
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: How to focus on a specified item?

    you, and juarez are so correct, i am sorry, it is only for a list, i.e. lcdui.list

    there is getselectedindex and setselectedindex methods

    I was going through all this code, and I just kept seeing it 20 plus times, and though it was inherited from lcdui.item

    I apologize

    Anyone know how to implement something similar?
    Jason Glass
    http://IChiBanComputers.Com

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    Thumbs up Re: How to focus on a specified item?

    This is exactly what I wanted to do in a game I'm developing. The user needed to input text into a textfield, so I wanted that field focused as default. You can use the following command to achieve this:

    display.setCurrentItem(item);

    where 'display' is a reference to the midlet diapay and 'item' is the component to focus upon.

    Cheers

  8. #8
    Registered User
    Join Date
    Mar 2006
    Posts
    2

    Re: How to focus on a specified item?

    Something I would like to know, is how to force an form component to retain focus. (ie, so a user cannot press the up/down arrows, changing the focus of a component). I can manage this using a customitem and overriding the traverse method, but can't do this with standard components, such as textfields.

    Or perhaps this is asking a bit much! Any ideas??!

  9. #9
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: How to focus on a specified item?

    nice pervasiveapp, I though there was a way

    with your dilemma, it sucks their is no lostfocus, focus changed, onchange methods, like there are in other languages
    Jason Glass
    http://IChiBanComputers.Com

Similar Threads

  1. Replies: 4
    Last Post: 2009-02-17, 21:24
  2. Custom item not displayed correctly
    By kakoskin in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-10-11, 21:50
  3. Replies: 0
    Last Post: 2004-03-04, 04:39
  4. change focus
    By f_alonso_1 in forum Symbian
    Replies: 0
    Last Post: 2003-07-17, 13:34
  5. List item selection
    By SanDan in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-06, 10:57

Posting Permissions

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