It must be a scope issue?
This has been driving my nuts for about a week now and I am at the end of my tether.
How do I make the underlined code in the following code refer to the same object as instantiated by the click on okCommand9 (in bold)?
The only way I can get "something" to work is by calling the same getCard() method, unfortunately this creates a new Card and messing everything up because the get card generates a random number.
I want the programme to create a new card, display a word, the user to input a word and then the programme to check if the input matches the "back of the Card".
okCommand9 gets and displays the word.
okCommand6 is what should happen once the user has input their word.
I pulling my hair out over this one.
Thanks
Dan
}elseif (command == okCommand9){
// For adding user code into this block, select "Design | Screens | LanguageForm [Form] | Assigned Commands | okCommand9" item in the inspector and invoke property editor on Action property in Properties window.
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_QuestionForm());
CardMobile displayCard = getCard();
if (answerInLanguage.getSelectedIndex() == 1){
String displayWord = displayCard.getEWord();
QuestionWordBox.setString(displayWord);
}else{
String displayWord = displayCard.getDWord();
QuestionWordBox.setString(displayWord);
}
}
}elseif (displayable == QuestionForm){
if (command == backCommand7){
// For adding user code into this block, select "Design | Screens | QuestionForm [Form] | Assigned Commands | backCommand7" item in the inspector and invoke property editor on Action property in Properties window.javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_LanguageForm());
}elseif (command == okCommand6){
// For adding user code into this block, select "Design | Screens | QuestionForm [Form] | Assigned Commands | okCommand6" item in the inspector and invoke property editor on Action property in Properties window.
javax.microedition.lcdui.Display.getDisplay(this).setCurrent(get_QuestionForm());
// CardMobile displayCard = getCard(0);
String userInput = UserInputBox.getString().trim();
String translatedWord = displayCard.getEWord().trim();
System.out.println(userInput);
System.out.println(translatedWord);
if (userInput.equals(translatedWord) ){
System.out.println("Correct");
}else{
System.out.println("Incorrect") ;
}
}
}
}

