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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 1
Registered: ‎04-27-2009
My Device: Not Specified

Missing Button Events on Storm

[ Edited ]

Have put 2 ButtonFields into a HorizontalFieldManager and am repositioning this on the screen using sublayout override.  Buttons respond to scrolling, and enter key press, but one of them is not responding to screen touch.   The other button responds correctly.  Problem goes away in the containing HorizontalFieldManager is not re-positioned, or if the button's preferred width is set to be a large value (eg. > 50 pixels).  From what I can tell, setPositionChild is causing the problem - but I can't understand why.

Has anyone seen this before?  I am including code just in case there is something really basic I am missing.

 

Thanks

 

 

 

public class TestScreen extends MainScreen {

   
    ButtonField aBut1 = new ButtonField("<",  ButtonField.CONSUME_CLICK);
    
ButtonField aBut3 = new ButtonField(">",  ButtonField.CONSUME_CLICK );
       

    public TestScreen() {

  
        VerticalFieldManager vfm = new VerticalFieldManager(NO_HORIZONTAL_SCROLL |
                NO_VERTICAL_SCROLL | USE_ALL_HEIGHT | USE_ALL_HEIGHT) {

         
            protected void sublayout(int maxWidth, int maxHeight) {

                super.sublayout(Display.getWidth(), Display.getHeight());

                int iCount = getFieldCount();

                for (int i = 0; i < iCount; i++) {

                    Field aField = getField(i);

                    layoutChild(aField, maxWidth, Display.getHeight());

                    if (aField instanceof HorizontalFieldManager) {  // reposition hfm

                          setPositionChild(aField, (Display.getWidth() - aField.getWidth()) / 2, Display.getHeight() /2 );        
                    }
                }
                setExtent(Display.getWidth(), Display.getHeight());
            }
        };

 

        HorizontalFieldManager hfmButt = new HorizontalFieldManager();

        LabelField label = new LabelField("label text");


        aBut1.setChangeListener(choseListener);
        aBut3.setChangeListener(choseListener);

 

        hfmButt.add(aBut1);
        hfmButt.add(label);
        hfmButt.add(aBut3);

 

        vfm.add(hfmButt);

        add(vfm);
    }

 

    FieldChangeListener choseListener = new FieldChangeListener() {

        public void fieldChanged(Field field, int context) {

          DoSomething();

        }
    };

Message Edited by Image9 on 04-27-2009 12:37 AM
BlackBerry Development Advisor
Posts: 15,889
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Missing Button Events on Storm

The "touch sensitve" areas within the HorizontalFieldManager seem to be cut off at the half way point.  If you make the LabelField focusable, you'll also see that only the left half of it responds to the touch event.  I have sent this issue to our development team.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.