BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   Developer Forum (http://www.blackberryforums.com/developer-forum/)
-   -   Button is not working on Storm (http://www.blackberryforums.com/developer-forum/215599-button-not-working-storm.html)

vidhi.thakrar 01-04-2010 09:47 AM

Button is not working on Storm
 
Hi,

I have placed two buttons in the VertcalFieldManager and to display both the buttons vertically center, i have used setPositionChild().

Now my problem is only first button is taking events but not the second one.

Below is my code snippet for VerticalFieldManager in which i added two ButtonFields.


VerticalFieldManager formScreenLayout = new VerticalFieldManager(
Manager.USE_ALL_WIDTH) {

protected void sublayout(int maxWidth, int maxHeight) {

MainScreen currentScreen = (MainScreen) UiApplication
.getUiApplication().getActiveScreen();
int height = currentScreen.getHeight();
for (int index = 0; index < currentScreen.getDelegate()
.getFieldCount(); index++) {

if (index != currentScreen.getDelegate()
.getFieldWithFocusIndex())
height -= currentScreen.getDelegate().getField(index)
.getHeight();
else
break;
}

super.sublayout(maxWidth, height);
setExtent(getWidth(), height);

int heightOfFields = getField(0).getHeight()
+ getField(1).getHeight() ;

setPositionChild(getField(0), getField(0).getExtent().x,
(height - heightOfFields) / 2);
setPositionChild(getField(1), getField(1).getExtent().x,
(height - heightOfFields)/2 + getField(0).getHeight());

}

};


Does any one have an idea why second button is not working on Storm????

renuka_anil 01-06-2010 08:38 AM

You need to override the touchevent mehtod

following link may help you.

http://www.blackberryforums.com/deve...st-fields.html

vidhi.thakrar 01-13-2010 01:40 AM

Thanks.

I did the same. But i didn't expect that on changing the position of a field, touchEvent() would be overridden.


All times are GMT -5. The time now is 02:50 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.