Control Events
Java Version: The simplest method to capture the events from Tej control is to use the TejAdapter class. Please refer to Creating an Editor Window topic an example of using this class.
public class TejAdapter implements TejListener {
public void OpenFile(TejEvent e)
public void Modified(TejEvent ev)
public void Action(TejEvent ev)
public void Preprocess(TejEvent ev)
public void UpdateStatusbar(TejEvent ev)
public void UpdateToolbar(TejEvent ev)
public void Hypertext(TejEvent ev)
public boolean MergeData(TejEvent ev)
public void PageSizeChanging(TejEvent ev)
public void Closing(TejEvent ev)
public void PageCount(TejEvent ev)
public void PostPaint(TejEvent ev)
public void SpellWordReplaced(TejEvent ev) // reserved for future use
public boolean DrawControl(TejEvent ev) // reserved for future used
public boolean DoDNS(TejEvent ev) // reserved for future use
public void SetUserField(TejEvent ev)
public void ReplaceLastWord(TejEvent ev)
public void TextDrag(TejEvent ev)
public boolean TextDrop(TejEvent ev)
public Component CreateEmbeddedControl(TejEvent ev)
public void PreHtmlAddon(TejEvent ev) // reserved for future use
public void ControlCreated(TejEvent ev)
}
As you would notice, these methods use the TejEvent class to pass the parameters. The description for each event includes the relevant TejEvent fields populated for the event.
HTML/Javascript version: The HTML/Javascript version also supports most of these events. The event must be caught within the ControlCreated function during initialization using the TerSetEvent function. Unlike the Java version, there is no TejEvent input parameter. Instead, the event parameters are passed to your script directly. Example:
te1.TerSetEvent("Preprocess",PreprocessEvent); // an example of catching the preprocess event
te1.TerSetEvent("Hypertext",Hypertext);
function PreprocessEvent(obj,ActionType,ActionId) {
//console.log("Preprocess, object id: ",obj.cvs.id,"type",ActionType,"id: ",ActionId);
}
function Hypertext(obj,HText,HCode) {
if (HCode.indexOf("http://")==0) window.open(HCode);
else if (HCode.indexOf("www.")==0) window.open("http://"+HCode);
else alert("Hypertext: "+HText+"\nCode/url: "+HCode);}
The description for these methods follows.