07-21-2011 06:09 AM - edited 07-21-2011 06:10 AM
--------------------------------------------------
- ButtonFieldLeft ButtonFieldRigth -
-
-
-
--------------------------------------------------
07-21-2011 06:43 AM
Hi,
give FIELD_RIGHT and FIELD_LEFT style for button field.
ButtonField buttonRight = new ButtonField("ButtonR",FIELD_RIGHT|CONSUME_CLICK);
ButtonField buttonLeft = new ButtonField("ButtonL",FIELD_LEFT|CONSUME_CLICK);
Thanks & Regards
pp
07-21-2011 06:49 AM
07-21-2011 06:50 AM
07-21-2011 06:51 AM
If it is the list of such buttons - I would create two VFM and use flags that suggested PP in previous post.
If it's one row - HFM and FlowFieldManager will ignore horizontal aligment. And there are two possible solutions - use absolute layout manager (which is availble from 5.0 OS) or implement your own manager with own layout.
07-21-2011 06:57 AM
07-21-2011 07:19 AM
Hi,
yes he was right.
If it's one row - HFM and FlowFieldManager will ignore horizontal aligment. And there are two possible solutions - use absolute layout manager (which is availble from 5.0 OS) or implement your own manager with own layout.
so here is a custom manager to make the fields align centre and u can change to align right and left
public class CenterManager extends Manager {
private boolean isCenter;
public CenterManager() {
super(Manager.USE_ALL_WIDTH);
}
public CenterManager(boolean isCenter) {
super(Manager.USE_ALL_WIDTH);
this.isCenter = isCenter;
}
private int getInitialX(int numberOfFields){
int x = Display.getWidth();
for (int i = 0;i < numberOfFields;i++) {
x -= getField(i).getWidth();
}
if(!isCenter){
return x;
}else{
return x/2;
}
}
protected void sublayout(int width, int height) {
Field field;
int numberOfFields = getFieldCount();
int x = getInitialX(numberOfFields);
int y = 0;
for (int i = 0;i < numberOfFields;i++) {
field = getField(i); //get the field
setPositionChild(field,x,y); //set the position for the field
layoutChild(field, width, height); //lay out the field
x += field.getWidth();
}
setExtent(getPreferredWidth(), getPreferredHeight());
}
public int getPreferredWidth() {
return Display.getWidth();
}
public int getPreferredHeight() {
if(getFieldCount() == 0)
{
return 0;
}
return getField(0).getHeight()+5;
}
}CenterManager cm1 = new CenterManager(true);
HorizontalFieldManager buttonManager = new HorizontalFieldManager();
cm1.add(buttonManager );
Thanks & Regards
pp
07-21-2011 07:56 AM
07-24-2011 10:56 PM
CONSUME_CLICK
public static final long CONSUME_CLICK
Indicates to the button consume the click event. Since: JDE 4.0.0
when the user click on the button the specified action to be performed by consuming that event.
In JDE, go to help tab, API preferences and you will get all the components and its details.
Thanks & Regards
pp
07-25-2011 12:27 AM
Hi,
check this custom manager -- BFHM here..
Thanks & Regards
pp