I made a popup screen in which there is an
EditField, and two ButtonField.
Now i am facing very wierd problem there is two button one is Cancel and the other one is Send button. Now the first button i am adding is not working fine and the second button working fine.For shake of simplicity in this code Cancel button will work and Send button won’t. What i am missing here can anyone will help me .
ButtonField sendButton,cancelButton;
PinPopup()//Constructor
{
super(new HorizontalFieldManager());
texts=new EditField("","",200,Field.EDITABLE);
sendButton = new ButtonField(" Send ");
sendButton.setChangeListener(this);
cancelButton = new ButtonField("Cancel");
cancelButton.setChangeListener(this);
VerticalFieldManager _fieldManagerContext = new VerticalFieldManager(VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT)
{
public void sublayout(int width,int height) {
super.sublayout(width, height);
int xpos = 10;
int ypos = 40;
Field field = getField(0);
layoutChild(field, 280, 50);
setPositionChild(field, xpos, ypos);
Field field1 = getField(1);
layoutChild(field1, 280, 50);
setPositionChild(field1, xpos+10, ypos+80);
Field field2 = getField(2);
layoutChild(field2, 280, 50);
setPositionChild(field2, xpos+145, ypos+80);
setPosition(150, 220);
setExtent(300, 220);
}
public void paint(){
Overrided
}
_fieldManagerContext.add(texts);
_fieldManagerContext.add(sendButton);
_fieldManagerContext.add(cancelButton);
public void fieldChanged(Field field, int context)
{
if(field==cancelButton)
{
Dialog.inform("Cancel");
}
if(field){
Dialog.inform("Send");
}
}
UPDATE
if(field==sendButton){
Dialog.inform("Send");
}
UPDATE
I have tried this too but the same problem now guys what to do
cancelButton = new ButtonField("Cancel") {
protected boolean navigationClick(int status, int time) {
return true;
}
};
The problem i was getting because i am adding two button in a row, and i had used a VerticalFieldManager for adding the buttons that is why i got the problem. And for solution i have added the button in HorizontalFeildManager and now it is working fine
to this one