TE Edit Control Java / HTML-JavaScript Help
Product page

ReplaceLastWord

This event is fired during keyboard text entry after the user completes a word. It lets you provide a replacement word for the word just entered.

void ReplaceLastWord(TejEvent ev)
  {
   // an example of replace the last word entered
   ev.replace=true;
   ev.NewText="";
   if (ev.LastWord.equals("dog")) ev.NewText="Golden Retriever";
   else if (ev.LastWord.equals("cat")) ev.NewText="Himalayan tiger";
   else ev.replace=false;
  } 

The relevant TejEvent fields:

String LastWord: // The 'LastWord' parameter indicates the word
                    just completed.
boolean replace; // The 'replace' parameter should be set to
                    true if you are providing a replace text.
String NewText;  // The 'NewText' parameter should be set to
                    the replacement text.