BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-27-2009, 09:01 AM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ButtonField Wierdness on Storm

Please Login to Remove!

Have put 2 ButtonFields into a HorizontalFieldManager and am repositioning this on the screen using sublayout override. Buttons respond to scrolling, and enter key press, but one of them is not responding to screen touch. The other button responds correctly. Problem goes away in the containing HorizontalFieldManager is not re-positioned, or if the button's preferred width is set to be a large value (eg. > 50 pixels). From what I can tell, setPositionChild is causing the problem - but I can't understand why.

Has anyone seen this before? I am including code just in case there is something really basic I am missing.



Thanks







public class TestScreen extends MainScreen {


ButtonField aBut1 = new ButtonField("<", ButtonField.CONSUME_CLICK);
ButtonField aBut3 = new ButtonField(">", ButtonField.CONSUME_CLICK );

public TestScreen() {

VerticalFieldManager vfm = new VerticalFieldManager(NO_HORIZONTAL_SCROLL |
NO_VERTICAL_SCROLL | USE_ALL_HEIGHT | USE_ALL_HEIGHT) {


protected void sublayout(int maxWidth, int maxHeight) {

super.sublayout(Display.getWidth(), Display.getHeight());

int iCount = getFieldCount();

for (int i = 0; i < iCount; i++) {

Field aField = getField(i);

layoutChild(aField, maxWidth, Display.getHeight());

if (aField instanceof HorizontalFieldManager) { // reposition hfm

setPositionChild(aField, (Display.getWidth() - aField.getWidth()) / 2, Display.getHeight() /2 );
}
}
setExtent(Display.getWidth(), Display.getHeight());
}
};



HorizontalFieldManager hfmButt = new HorizontalFieldManager();

LabelField label = new LabelField("label text");


aBut1.setChangeListener(choseListener);
aBut3.setChangeListener(choseListener);



hfmButt.add(aBut1);
hfmButt.add(label);
hfmButt.add(aBut3);



vfm.add(hfmButt);

add(vfm);
}



FieldChangeListener choseListener = new FieldChangeListener() {

public void fieldChanged(Field field, int context) {

DoSomething();

}
};
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





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