renuka_anil
10-08-2009, 01:46 AM
Hi All,
Here is my code snippet.
int footerHeight = footerImage.getHeight();
footerManager = new HorizontalFieldManager(HorizontalFieldManager.NO_VERTICAL_SCROLL
| HorizontalFieldManager.NO_HORIZONTAL_SCROLL | HorizontalFieldManager.FOCUSABLE){
public void paint(Graphics graphics){
int partVal = Display.getWidth()/6;
int xPos = partVal;
if(btnExplore != null){
xPos = (partVal-btnExplore.getWidth())/2;
setPositionChild(btnExplore, xPos, 0);
}
if(btnSearch != null){
xPos = (partVal-btnSearch.getWidth()/2)+(partVal/2);
setPositionChild(btnSearch, xPos , 0);
}
if(btnFavourite != null){
xPos = (partVal-btnFavourite.getWidth()/2)+(partVal+(partVal/2));
setPositionChild(btnFavourite, xPos , 0);
}
if(btnPersonal!= null){
xPos = (partVal-btnPersonal.getWidth()/2)+((partVal*2)+partVal/2);
setPositionChild(btnPersonal, xPos, 0);
}
if(btnabout != null){
xPos = (partVal-btnabout.getWidth()/2)+((partVal*3)+(partVal/2));
setPositionChild(btnabout, xPos, 0);
}
if(btnExit != null){
xPos = (partVal-btnExit.getWidth()/2)+((partVal*4)+(partVal/2));
setPositionChild(btnExit, xPos, 0);
}
graphics.setColor(0x800000);
graphics.drawBitmap(0, 0, Display.getWidth(), footerHeight, footerImage, 0 , 0);
if(Container.isFirst == 0){
invalidate();
}
super.paint(graphics);
}
public void sublayout(int maxWidth, int maxHeight){
maxWidth = Display.getWidth();
maxHeight = footerHeight;
super.sublayout(maxWidth, maxHeight);
setExtent(maxWidth, maxHeight);
}
public int getPreferredWidth(){
return Display.getWidth();
}
public int getPreferredHeight(){
return footerHeight;
}
};
btnabout = new CustomButton(null, "MyApp/images/about-us.png", "MyApp/images/blueabout-us.png", false);
btnFavourite = new CustomButton(null, "MyApp/images/grey-star.png", "MyApp/images/blue.png", false);
btnExplore = new CustomButton(null, "MyApp/images/explore.png", "MyApp/images/blue-expore.png", false);
btnSearch = new CustomButton(null, "MyApp/images/grey-search.png", "MyApp/images/blue-search.png", false);
btnPersonal= new CustomButton(null, "MyApp/images/my-vows-grey.png", "MyApp/images/my-vows-blue.png", false);
btnExit = new CustomButton(null, "MyApp/images/exit.png", "MyApp/images/blue_exit.png", false);
footerManager.add(btnExplore);
footerManager.add(btnSearch);
footerManager.add(btnFavourite);
footerManager.add(btnPersonal);
footerManager.add(btnabout);
footerManager.add(btnExit);
I have added this manager in verticalFieldManager.
My problem is the last two button's touchevent is not get captured.
Like footer manager I have headerManager (HorizontalFieldManager). In that I placed one button at left corner and one at right corner. In that left corner button's touch event get captured but right button's touchevent is not getting captured.
In short.. the fields that I place at right corner (right 1/4 of screen) did not capture the touch event. This is happeing in device too.
can anybody please tell me what to do for this. I already posted my snippet.
Thanks.
Here is my code snippet.
int footerHeight = footerImage.getHeight();
footerManager = new HorizontalFieldManager(HorizontalFieldManager.NO_VERTICAL_SCROLL
| HorizontalFieldManager.NO_HORIZONTAL_SCROLL | HorizontalFieldManager.FOCUSABLE){
public void paint(Graphics graphics){
int partVal = Display.getWidth()/6;
int xPos = partVal;
if(btnExplore != null){
xPos = (partVal-btnExplore.getWidth())/2;
setPositionChild(btnExplore, xPos, 0);
}
if(btnSearch != null){
xPos = (partVal-btnSearch.getWidth()/2)+(partVal/2);
setPositionChild(btnSearch, xPos , 0);
}
if(btnFavourite != null){
xPos = (partVal-btnFavourite.getWidth()/2)+(partVal+(partVal/2));
setPositionChild(btnFavourite, xPos , 0);
}
if(btnPersonal!= null){
xPos = (partVal-btnPersonal.getWidth()/2)+((partVal*2)+partVal/2);
setPositionChild(btnPersonal, xPos, 0);
}
if(btnabout != null){
xPos = (partVal-btnabout.getWidth()/2)+((partVal*3)+(partVal/2));
setPositionChild(btnabout, xPos, 0);
}
if(btnExit != null){
xPos = (partVal-btnExit.getWidth()/2)+((partVal*4)+(partVal/2));
setPositionChild(btnExit, xPos, 0);
}
graphics.setColor(0x800000);
graphics.drawBitmap(0, 0, Display.getWidth(), footerHeight, footerImage, 0 , 0);
if(Container.isFirst == 0){
invalidate();
}
super.paint(graphics);
}
public void sublayout(int maxWidth, int maxHeight){
maxWidth = Display.getWidth();
maxHeight = footerHeight;
super.sublayout(maxWidth, maxHeight);
setExtent(maxWidth, maxHeight);
}
public int getPreferredWidth(){
return Display.getWidth();
}
public int getPreferredHeight(){
return footerHeight;
}
};
btnabout = new CustomButton(null, "MyApp/images/about-us.png", "MyApp/images/blueabout-us.png", false);
btnFavourite = new CustomButton(null, "MyApp/images/grey-star.png", "MyApp/images/blue.png", false);
btnExplore = new CustomButton(null, "MyApp/images/explore.png", "MyApp/images/blue-expore.png", false);
btnSearch = new CustomButton(null, "MyApp/images/grey-search.png", "MyApp/images/blue-search.png", false);
btnPersonal= new CustomButton(null, "MyApp/images/my-vows-grey.png", "MyApp/images/my-vows-blue.png", false);
btnExit = new CustomButton(null, "MyApp/images/exit.png", "MyApp/images/blue_exit.png", false);
footerManager.add(btnExplore);
footerManager.add(btnSearch);
footerManager.add(btnFavourite);
footerManager.add(btnPersonal);
footerManager.add(btnabout);
footerManager.add(btnExit);
I have added this manager in verticalFieldManager.
My problem is the last two button's touchevent is not get captured.
Like footer manager I have headerManager (HorizontalFieldManager). In that I placed one button at left corner and one at right corner. In that left corner button's touch event get captured but right button's touchevent is not getting captured.
In short.. the fields that I place at right corner (right 1/4 of screen) did not capture the touch event. This is happeing in device too.
can anybody please tell me what to do for this. I already posted my snippet.
Thanks.