Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148?

[ Edited ]

I have a relatively simple Horizontal field manager, with subclassed ButtonFields  BitmapFields in it. I draw some hilighting when each button gets the focus.

 

On my 4.7.0.75 Storm simulator, and previously on my actual device, when I would tap and drag (really a "swipe") in the field manager, each button would get the focus as my finger swiped across it.  Now on my Verizon 9530 Storm, 4.7.0.148, the swipe gets "stuck" on the button you tap on. I can still tap on any of the buttons, I just can't swipe between them.

 

Note that my HorizontalFieldManager does override touchEvent, but calls super.touchEvent(message) almost all the time (other than when touchEvent is UP).

 

Was this change on purpose? Is there a recommended way to get the old behavior?

 

-Morgan

 

P.S. I've confirmed this also happens in the 148 simulator.

Message Edited by morganbelford on 07-08-2009 03:03 AM
Message Edited by morganbelford on 07-08-2009 11:57 AM
Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Hi,

 

Are you returning false in touchEvent(message) to indicate that you are not consuming touch event.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

No, but I am calling super.touchEvent(message) and returning the value. I thought that was the recommended pattern.

 

I feel like the BitmapField subclass I am using for buttons that may be the thing that has changed, and that it now  "captures" the initial tap.

 

Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Hi,

 

Write something like this in the touchEvent()

 

 super.touchEvent(message);

 return false; 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

That was a decent thought. I did try it that way (also just returning false period), with no change.  I am still interested to know what changed between 4.7.0.75 and 148.
Please use plain text.
Administrator
MSohm
Posts: 14,525
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Can you provide some sample code that triggers this behaviour?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

I will post some this weekend. Thanks.
Please use plain text.
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Mark,

 

Here is a simple app. It has a main screen, which contains a HorizontalFieldManager with four BitmapFields, and also a LabelField to display info.

 

The MainScreen is the FocusChangeListener for the four BitmapFields.

 

In 4.7.0.75, I can tap and swipe across the BitmapFields, and as I go over each one, the FocusChangeListener will trigger.

 

In 4.7.0.148, I can tap and swipe across the BitmapFields, but the focus stays "stuck" on whichever BitmapField I tap on first. 

 

While the 148 behavior actually makes more sense to me (the initial target "captures" the subsequent gestures, like swipes), I liked the old behavior since it made my "toolbar" more like a menu, where the user could swipe across it and see tooltips for each button in turn.

 

Is there any way to make 148 act more like 75 in this regard?

 

 

I can also send you a zip file with the app. I don'tsee how to attach files to these posts up here.

 

BitmapMenuBarApp.java

==================

import net.rim.device.api.ui.UiApplication;

public class BitmapMenuBarApp extends UiApplication
{
    public BitmapMenuBarApp()
    {
        pushScreen(new BitmapMenuBarScreen());
    }

    public static void main(String[] args)
    {
        BitmapMenuBarApp app = new BitmapMenuBarApp();
        app.enterEventDispatcher();
    }

}

 

 

 

BitmapMenuBarScreen.java

====================
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FocusChangeListener;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;

public class BitmapMenuBarScreen extends MainScreen implements FocusChangeListener
{
    LabelField _lblInfo;
    BitmapField _bf1, _bf2, _bf3, _bf4;
    HorizontalFieldManager _mgr;
   
    public BitmapMenuBarScreen()
    {
        super(MainScreen.DEFAULT_CLOSE | MainScreen.DEFAULT_MENU);
       
        _mgr = new HorizontalFieldManager();
       
        _bf1 = new BitmapField(Bitmap.getBitmapResource("status.png"), BitmapField.FOCUSABLE);
        _bf1.setFocusListener(this);
        _mgr.add(_bf1);
       
        _bf2 = new BitmapField(Bitmap.getBitmapResource("tmActive.png"), BitmapField.FOCUSABLE);
        _bf2.setFocusListener(this);
        _mgr.add(_bf2);

        _bf3 = new BitmapField(Bitmap.getBitmapResource("tmPaused.png"), BitmapField.FOCUSABLE);
        _bf3.setFocusListener(this);
        _mgr.add(_bf3);

        _bf4 = new BitmapField(Bitmap.getBitmapResource("tmStopped.png"), BitmapField.FOCUSABLE);
        _bf4.setFocusListener(this);
        _mgr.add(_bf4);

        add(_mgr);
       
        _lblInfo = new LabelField("no info yet");
        add(_lblInfo);
   
    }

    public void focusChanged(Field field, int eventType)
    {
        int i = field.getIndex();
        if (eventType == FocusChangeListener.FOCUS_GAINED)
            _lblInfo.setText("focusGained for " + String.valueOf(i));
    }
}
 

 

Please use plain text.
Developer
Rajat_10Sep
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Hi,

 

I think line field.getIndex(); will not work correctly because all your fields are in a horizontalmanager and it will return the same index every time.You should try to type cast that field object into horizontalfield manager object and then use horizontalfieldmanager functions to get the index of the field.

 

HorizontalFieldManager class has many functions like getIndex(),getSelectedIndex() etc.

 

 

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
Please use plain text.
Developer
morganbelford
Posts: 35
Registered: ‎12-12-2008
My Device: Not Specified

Re: Storm, HorizontalFieldManager, Buttons, Swiping, and Focus -- has something changed in 4.7.0.148

Rajat,

 

I appreciate the advice, though that part of the code is not so much the focus of the post/question.  Note that the FocusChangeListener is attached to each of the BitmapFields in the HorizontalFieldManager, and so the field argument to the focusChange method is the BitmapField with the current focus, rather than the HorizontalFieldManager itself.  In any case, this part of the code seems to work just fine.

 

-Morgan

Please use plain text.