Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

command button not able to display need help

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gurus;
Well my project is stuck due the reason that sl45i emulator does not
show any command button when i use textfield with it.
Here is program which i am trying to solve my problem
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Test extends MIDlet implements CommandListener{
private Display display; // Reference to display object
private Form fmMain; // The main form
private Command cmInsert; // Command to insert items
private Command cmExit; // Command to exit
private DateField dfDate; // Display date
private TextField tfSize; // Product size
private TextField tfQuantity;// Product quantity
private int dateIndex; // Index of dfDate
public Test(){
display = Display.getDisplay(this);
// Create the date and populate with current date
// Define two textfields and two commands
tfSize = new TextField("Enter",null,15, TextField.NUMERIC);
cmInsert = new Command("Insert", Command.SCREEN, 2);
fmMain = new Form("Form Data...");
fmMain.append(tfSize);
fmMain.addCommand(cmInsert);
fmMain.setCommandListener(this);
}

public void startApp(){
display.setCurrent(fmMain);
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c, Displayable s){
}
}
Please i need help.Will be very yhankful.
Jawwad Ahmed
 
Rishi Tyagi
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jawwad,
there is command button on the screen but will be shown to you when you will scroll down.
Actually according to my experience with sl45i when you load some screen like this (you program) then the focus is at your text field while your command is associated with the form so when you will scroll down or up the screen using down/up arrow navigation key on the emulator or on the real phone then focus will be transfered to the form and then your command will be shown to you.
Rishi
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic