TE Edit Control Java / HTML-JavaScript Help
Product page

WebTej Control Events

WebTej control does not support any server-side events.

The embedded Tej control fires the regular events within the WebPage. The names of the events to handle is specified using the FireEvents property. You can set this property using the property-box in VisualStudio. A full description of the available event names and corresponding input parameter can be found in the Control Events topic.

For example, if you set the FireEvents property to "ControlCreated,Preprocess", the following property statement would be created in the page generated by IIS:

<Param name="FireEvents" value="ControlCreated,Preprocess">

You would also need to include the corresponding function definition in your html page:

<SCRIPT type="text/javascript">
     <!--
     function ControlCreated()  
     {
          window.status = "Page is loaded!";
          tej.TerStopEvents();  // this function must be called at the beginning
                                // of any function making calls into Tej object.
                                // Later call the TerResumeEvents to resume the
                                // events
          // Example of adding or removing toolbar icons
          tej.TerAddToolbarIcon(0,0,tej.ID_SUPSCR_ON,
                 "http://localhost/DmoTej/images/icon1.bmp","superscript"); 
          tej.TerAddToolbarIcon(0,0,tej.ID_SUBSCR_ON,
                 "http://localhost/DmoTej/images/icon2.bmp","subscript");
          tej.TerRecreateToolbar(true);
          // Example of disabling a speedkey
          tej.TerEnableSpeedKey(tej.ID_CHAR_STYLE,0);  // disable the original
                                                       // Alt+1 keycommand
          tej.TerResumeEvents();  // This pairing function must be called to
                                  // resume events, the editor will stop
                                  // functioning if this call is omitted.
     } 
     function Preprocess(ActionType, ActionId) 
     {      
        tej=WebTej1;  // short cut variable
        if (ActionType == tej.ACTION_COMMAND && ActionId==tej.ID_SAVE) {  
                 window.alert("Save button clicked");    // your action here...
                                           // we are simply displaying a message 
                 tej.TerIgnoreCommand();   // tell TE to ignore processing of
                                           // this command
        }
     }
     //-->
</SCRIPT>

In the examples above, WebTej1 refers the the 'object' hosting the Tej control.

Please refer to the included DmoTej.aspx file for a complete example.