BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-15-2007, 11:31 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2007
Model: 8100
Carrier: T-Mobile
Posts: 54
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Next field focus problem.

Please Login to Remove!

Hello all,

I have a problem cycling thru a set of CheckboxFields contained within a FlowFieldManager. I've created a small example to illustrate the behavior problem. This example is NOT A REAL IMPLEMENTATION. Just simply to demonstrate the problem.

I have a screen that contains a FlowFieldManager.

Within the FlowFieldManager, I have 3 HorizontalFieldManager fields. I have overridden methods within the HorizontalFieldManager to fix the width of the manager to the width of the screen. This forces the fields to display as if there were within a VerticalFieldManager.

In the first HorizontalFieldManager, I have a focusable LabelField.
In the second HorizontalFieldManager, I have a VerticalFieldManager that contains 6 CheckboxFields.
In the third HorizontalFieldManager, I have another focusable LabelField.

When you roll the trackwheel (or pearl) in a downward direction, the focus goes to the first LabelField. Then the focus goes to the 1st CheckboxField, then jumps to the final LabelField. The focus totally skips CheckboxFields 2 thru 6.

I'm a bit purplexed by this.

Below is the real source code. Any help will be GREATLY appreciated.

Sincerely,
Matthew Wheaton

Code:
package com.wcs.blackberry;

import net.rim.device.api.system.Characters;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.CheckboxField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.FlowFieldManager;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class Sandbox extends UiApplication
{
  public static void main(String[] args)
  {
    Sandbox theApp = new Sandbox();
    theApp.enterEventDispatcher();
  }

  public Sandbox()
  {
    MainScreen screen = new SandboxScreen();
    pushScreen(screen);
  }
}

final class SandboxScreen extends MainScreen
{
  private int width = Graphics.getScreenWidth();
  private class MyHFM extends HorizontalFieldManager
  {
    protected void sublayout(int maxWidth, int maxHeight)
    {
      super.sublayout(width, maxHeight);
      setExtent(width, getExtent().height);
    }

    public int getPreferredWidth()
    {
      return width;
    }
  }

  public SandboxScreen()
  {
    super(MainScreen.DEFAULT_MENU | MainScreen.DEFAULT_CLOSE);

    CheckboxField sunCheck = new CheckboxField("a", false);
    CheckboxField monCheck = new CheckboxField("b", false);
    CheckboxField tueCheck = new CheckboxField("c", false);
    CheckboxField wedCheck = new CheckboxField("d", false);
    CheckboxField thuCheck = new CheckboxField("e", false);
    CheckboxField friCheck = new CheckboxField("f", false);
    CheckboxField satCheck = new CheckboxField("g", false);

    VerticalFieldManager mgr = new VerticalFieldManager();
    mgr.add(sunCheck);
    mgr.add(monCheck);
    mgr.add(tueCheck);
    mgr.add(wedCheck);
    mgr.add(thuCheck);
    mgr.add(friCheck);
    mgr.add(satCheck);

    FlowFieldManager ffm = new FlowFieldManager();

    HorizontalFieldManager hfm = new MyHFM();
    hfm.add(new LabelField("fld 1", LabelField.FOCUSABLE));
    ffm.add(hfm);
    hfm = new MyHFM();
    hfm.add(mgr);
    ffm.add(hfm);
    hfm = new MyHFM();
    hfm.add(new LabelField("fld 3", LabelField.FOCUSABLE));
    ffm.add(hfm);

    add(ffm);
  }

  public boolean onClose()
  {
    System.exit(0);
    return true;
  }

  public boolean keyChar(char key, int status, int time)
  {
    invalidate();
    switch (key)
    {
      case Characters.ESCAPE:
        onClose();
        return true;
    }
    return super.keyChar(key, status, time);
  }

}
Offline  
Old 07-16-2007, 10:02 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey matt,
so I implemented the above and can't duplicate the experience you're having. have you tried this with the trackwheel instead of the pearl nub? I've seen some weird things happen wrt: vfms and the nub. To debug this further, I'd implement trackwheelRoll w/i your class there and see what the amount and status values are when you see the jump. perhaps your clue is in there.
Offline  
Old 07-16-2007, 01:03 PM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Oct 2006
Model: 7103
Carrier: Verizon
Posts: 259
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Matt,
So instead of guessing, I've gone ahead and run the above on an 8800 simulator with the pearl-nub navigation and it still seems to be working fine.

Maybe someone can jump in and answer this question:
What handles the motion in a Flow Field Manager when you're using an 8800 series or pearl "nub" instead of a trackwheel?

I want to account for a movement action within a flow field via trackwheelListenerRoll(int,int,int), but the only time I see a trackwheelRoll event is when I attempt to scroll to some place that is out of bounds. Either left when I'm at the leftmost position, right at rightmost, down at bottom and so on. How to I track these events?
Offline  
Old 07-17-2007, 10:39 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2007
Model: 8100
Carrier: T-Mobile
Posts: 54
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default SOLVED : Next field focus problem.

Thanks to anyone who took a look at this. It appears the problem was with the JDE simulator itself. When I deployed this to my actual device, it works fine.

The JDE I'm using is 4.2.0, and my Pearl is 4.2.1

I suppose it's time to upgrade my JDE to see if this problem goes away there too.

Hope I didn't inconvenience anyone.

Thanks again,
mw
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.