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

Reply
New Developer
Posts: 15
Registered: ‎07-20-2009
My Device: Not Specified

Manager with padding causes incorrect touch position for buttons/fields

I am having a real problem with touch/click positions on ButtonField's (even on CustomButtonField's I have created) on the Storm.

 

The problem is simple to recreate - 

1) Add a Manager to a screen (VerticalFieldManager on a MainScreen in my example)

2) Set padding all the way around the manager (Top/Left seems most important to recreate)

3) Add two or more buttons to it

 

The problem behavior is when I tap or click the screen, it looks like it isn't realizing the buttons are offset by the manager's padding.  Thus, you click where the button would be if the manager didn't have padding it functions as expected (but is completely the wrong position compared to what you see visually), but the right/bottom of the button do not handle the click.

 

Not sure what I'm doing wrong.  Below is a screenshot where I depict the behavior I'm seeing as well as a code sample for a screen that I can recreate this with.  

 

I'm using the 4.7.0_4.7.0.36 MDS Simulator in Eclipse and have selected the 4.7.0 component pack.

 

This is keeping me from finishing an app I'm working on.  Thanks in advance!

Curt

 

public class TestScreen extends MainScreen { public TestScreen() { super(DEFAULT_MENU | DEFAULT_CLOSE | NO_HORIZONTAL_SCROLL | USE_ALL_WIDTH | VERTICAL_SCROLL | NON_FOCUSABLE); buildUI(); } public void buildUI() { VerticalFieldManager manager = new VerticalFieldManager(Manager.NON_FOCUSABLE | Manager.USE_ALL_WIDTH); manager.setPadding(new XYEdges(20, 20, 20, 20)); //REMOVE THIS AND THE CLICK/TAP POSITION WORKS PERFECTLY ButtonField button2 = new ButtonField("Click Me 1", ButtonField.CONSUME_CLICK) { protected boolean navigationClick(int status, int time) { setLabel("Clicked"); invalidate(); return true; } }; manager.add(button2); ButtonField button1 = new ButtonField("Click Me 2", ButtonField.CONSUME_CLICK) { protected boolean navigationClick(int status, int time) { setLabel("clicked"); invalidate(); return true; } }; manager.add(button1); add(manager); } }

 Problem Depiction

 

 

New Developer
Posts: 15
Registered: ‎07-20-2009
My Device: Not Specified

Re: Manager with padding causes incorrect touch position for buttons/fields

Bump...  Am I the only one that experiences this behavior?  Could it be the version of simulator I'm using?  This is seriously impeding development.

 

Developer
Posts: 70
Registered: ‎08-10-2009
My Device: Not Specified

Re: Manager with padding causes incorrect touch position for buttons/fields

bump.... did you find a solution to this problem, or does anyone know what is wrong with this solution ?

 

Thanks.

Developer
Posts: 70
Registered: ‎08-10-2009
My Device: Not Specified

Re: Manager with padding causes incorrect touch position for buttons/fields

currently reading through the following docs - transitioning to Touch Screen devices - am sure will solve the problem

 

http://docs.blackberry.com/en/developers/deliverables/8488/Touch_Transition_Guide.pdf

 

 

 

Highlighted
New Developer
Posts: 15
Registered: ‎07-20-2009
My Device: Not Specified

Re: Manager with padding causes incorrect touch position for buttons/fields

I was able to resolve this.  It turned out to be a simulator/OS version problem with the version of the Eclipse plugin I was using.  Updating the 9530 simulator to v. *.148 resolved it.  I think the latest version of the plugin ships with a simulator that won't have the problem.