Discussion Board

Results 1 to 3 of 3

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2008

    How to set focus on a component in a flow?

    I am having some difficulty finding how to SET the focus on a FOCUSABLE component in a FLOW. The program allows the user to move the cursor around a grid, and then make a selection. The ACTION associated with the component casues a REPAINT, and then the focus is lost. I want to reset the focus, so the user does not have to move the cursor back to the location already selected...

    Is there a way to do this? I have the indexOf stored away, so I can easily know what component index I need to use, but can't figure out how to set the focus.

    It may be important here to note that the ACTION causes a redraw of the whole grid, not just that element. So I need to repaint the FLOW not just the component.

    any ideas?

  2. #2
    Regular Contributor
    Join Date
    Jul 2004

    Re: How to set focus on a component in a flow?

    Repaint shouldn't lose focus. How do you "repaint"? By flushScreen(true) or by re-creating all components?)

    Anyways, you could save reference to the Component you wish focus to, and after repainting shell.setFocused(component);

  3. #3
    Registered User
    Join Date
    Aug 2008

    Re: How to set focus on a component in a flow?

    Thanks render. I was recreating the components and then issuing a flow.repaint(false).

    After posting my question, I did decide that the program's function would not suffer if I just changed all the components images, rather than recreate them. This kept the focus. Probably more efficient anyways. I had first thought that since I was chainging all the components, anyway, it would not make much difference.

    However, it is good to know that there exists the setFocused on the shell object. I must have overlooked it. Certainly there will be good reason to use it, as the next level of the program will randomly place the cursor on a component.

Similar Threads

  1. Set Focus
    By Spider_Eg in forum Mobile Java General
    Replies: 1
    Last Post: 2006-08-31, 15:07
  2. Replies: 2
    Last Post: 2006-07-28, 17:55
  3. Replies: 0
    Last Post: 2006-07-24, 10:43
  4. change focus
    By f_alonso_1 in forum Symbian
    Replies: 0
    Last Post: 2003-07-17, 13:34

Posting Permissions

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