BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-08-2009, 01:46 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default capturing touchevent of right most fields

Please Login to Remove!

Hi All,
Here is my code snippet.
int footerHeight = footerImage.getHeight();
footerManager = new HorizontalFieldManager(HorizontalFieldManager.NO_V ERTICAL_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.
__________________
Crazy for BlackBerry
Offline  
Old 10-27-2009, 02:06 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Mar 2007
Location: India
Model: 8100
Carrier: Airtel
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi All,

I got solution for this..

In main manager in which footermanager is added i have handled touchEvent.

in that i have handled touchevent of all these fields manually.

Here is code

case TouchEvent.CLICK :
inde = getFieldAtLocation(event.getX(1),
event.getY(1));
if(inde != -1){
Field fm = getField(inde);
if(fm.equals(vfmMain)){
int index1 = vfmMain.getFieldAtLocation(event.getX(1),
event.getY(1));
// Ignore click events outside any fields
if (index1 == -1)
return true;
Field field = vfmMain.getField(index1);
if(field.equals(footerManager)){
//Container.isFooterManager = true;
int index2 = footerManager.getFieldAtLocation(event.getX(1),
event.getY(1));
if(index2 != -1){
Field field1 = footerManager.getField(index2);
if(field1.equals(btnExplore)){
btnExplore.touchEvent(event);
setFocusOnField();
return true;
}else if(field1.equals(btnFavourite)){
btnFavourite.touchEvent(event);
setFocusOnField();
return true;
}else if(field1.equals(btnSearch)){
btnSearch.touchEvent(event);
setFocusOnField();
return true;
}else if(field1.equals(btnabout)){
btnabout.touchEvent(event);
setFocusOnField();
return true;
}else if(field1.equals(btnMyVows)){
btnPersonal.touchEvent(event);
setFocusOnField();
return true;
}else if(field1.equals(btnExit)){
btnExit.touchEvent(event);
setFocusOnField();
return true;
}
}
}
}
}
__________________
Crazy for BlackBerry
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Commodore Amiga Time Base Corrector VT-2000 TBC II Digital Processing (D9-5)
$250.0
Commodore Amiga Time Base Corrector VT-2000 TBC II Digital Processing  (D9-5) pictureCommodore Amiga Power Supply PA-4201-5A A2000 A2500 A3000 A4000 (D4)
$65.0
Commodore Amiga Power Supply PA-4201-5A     A2000 A2500 A3000 A4000       (D4) pictureCommodore Amiga Supraram 2000 4mb Expansion A2000 A2500 A3000 A4000 (D9-3)
$45.0
Commodore Amiga Supraram 2000 4mb Expansion A2000 A2500 A3000 A4000    (D9-3) pictureCommodore Amiga A2091 Hard Drive and Controller Card Quantum ProDrive LPS (D9-2)
$131.0
Commodore Amiga A2091 Hard Drive and Controller Card Quantum ProDrive LPS (D9-2) pictureCommodore Amiga A2000 A2500/50 Accelerator Card 312291 BR98YVA2630 (D9-1)
$250.0
Commodore Amiga A2000  A2500/50 Accelerator Card 312291  BR98YVA2630  (D9-1) picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.