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
neoknip
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800
Accepted Solution

SpinBoxField doesn't spin after TouchEvent() method is overridden in the VerticalFieldManager, which is the Parent Manager for SpinBoxFieldManager

Hi,

JDE - BB JDE 6.0

Simulator - BB Torch

Device - BB Torch

 

I have a SpinBoxFieldManager (SBFM) with two TextSpinBoxField (TSBF).

I have added the SBFM in a VerticalFieldManager (VFM).

 

Normally it works fine.

 

But i had to override the TouchEvent() Method for the VFM. (to detect the swipe gesture and to pop the screen)

 

When i override the TouchEvent() method in the VFM, the two spin box fields (TSBF) doesn't detect the swipe gesture and never spins.

 

What am i doing wrong here? Need Help...

Developer
jprofitt
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: SpinBoxField doesn't spin after TouchEvent() method is overridden in the VerticalFieldManager, which is the Parent Manager for SpinBoxFieldManager

I would say to make sure that isEditable() is true still. By default a TextSpinBoxField should be editable for touchscreen devices, but you may want to be sure. You can call setEditable(true) if it isn't.

Developer
neoknip
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Re: SpinBoxField doesn't spin after TouchEvent() method is overridden in the VerticalFieldManager, which is the Parent Manager for SpinBoxFieldManager

Hi,

I did chk that..

isEditable() returns true.

 

the code for the overridden touchevent() method for the VerticalFieldManager is below

iVFM1 = new VerticalFieldManager(VerticalFieldManager.NO_VERTICAL_SCROLL | VerticalFieldManager.USE_ALL_WIDTH)
{
    protected boolean touchEvent(TouchEvent message)
    {
        //
        int eventcode = message.getEvent();
        
        if (eventcode == TouchEvent.GESTURE)
        {
            boolean a = iSBF_Temp.isEditable();
            TouchGesture gesture = message.getGesture();
            int gesturecode = gesture.getEvent();
            
            if (gesturecode == TouchGesture.SWIPE)
            {
                int gesturedir = gesture.getSwipeDirection();
                if (gesturedir == TouchGesture.SWIPE_EAST)
                {
                    synchronized (Application.getEventLock())
                    {
                        popScreen(iScreen);
                    }
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                return false;
            }
        }
        else
        {
            return false;
        }
    }
};

 

Developer
neoknip
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Re: SpinBoxField doesn't spin after TouchEvent() method is overridden in the VerticalFieldManager, which is the Parent Manager for SpinBoxFieldManager

Hi .. I figured out my mistake..

instead of returning false .. i need to retun the value after letting the super handle the touch event.

 

return super.touchEvent(message);

 

this solved the problem.