Search code examples
blackberryjava-meblackberry-torch

Touch screen keyboard not displaying correctly


When the user hovers over editfield below the touch screen keyboard does not display. What is displayed is a white area that is same size as keyboard. This is an issue on BlackBerry Torch. I would expect the touch screen keyboard to appear correctly using below code ?

BasicEditField nameField = 
    new BasicEditField(
        "  "+Local.getInfo8()+ " : ", "", 100, BasicEditField.FILTER_DEFAULT)
    {
        private int iRectX = getFont().getAdvance(getLabel());
        private int iRectWidth = backgroundButtonBitmap.getWidth() - iRectX - 4;
        public int getPreferredHeight() {
            return backgroundButtonBitmap.getHeight() / 2;
        }

        public void layout(int width, int height) {
            //setExtent(width, getPreferredHeight());
            super.layout(width, getPreferredHeight());
        }

        public void paint(Graphics g) {
            g.setColor(Color.BLACK);
            g.setBackgroundColor(Color.WHITE);
            //g.drawRect(iRectX, 0, iRectWidth, 20);
            super.paint(g);
        }
    };

Solution

  • On the display screen, the method sublayout was being overriden -

    protected void sublayout( int maxWidth, int maxHeight ) {

    super.sublayout( maxWidth, maxHeight );
    setExtent(maxWidth,Constants.BACKGROUND_IMAGE.getHeight());  
    

    }

    The line - setExtent(maxWidth,Constants.BACKGROUND_IMAGE.getHeight()); is causing the issue.