Secure Global Desktop Administration Guide > Applets > getEmulatorState (terminal emulator applet)

getEmulatorState (terminal emulator applet)

Syntax

int getEmulatorState()

Description

The getEmulatorState method returns the status code associated with the emulator session's display engine. This allows you to determine if an emulator session is starting, running or stopped.

This return value...Indicates...
0 The terminal emulator session is starting, but hasn't yet connected to the application server.
1The terminal emulator session is running.
2The terminal emulator session has disconnected from the application server.
3An error has occurred, and the terminal emulator session has been terminated.
4The terminal emulator session has been suspended.
5The terminal emulator session has finished.

Examples

<SCRIPT LANGUAGE="JavaScript">

window.onerror = trapError

function trapError(message, url, line) {
   alert("There's no terminal emulator session running");
   return true
}

function getState() {
   state = top.WebtopFrame.DisplayFrame.document.applets["Tarantella Terminal Emulator"].getEmulatorState();
 
   switch (state) {
      case 0 :
         output = "The terminal emulator session is starting.";
         break;
      case 1 :
         output = "The terminal emulator session is running.";
         break;
      case 2 :
         output = "The terminal emulator session has disconnected.";
         break;
      case 3 :
         output = "An error has occurred.";
         break;
      case 4 :
         output = "The terminal emulator session has been suspended.";
         break;
      case 5 :
         output = "The terminal emulator session has finished.";
         break;
   }

   alert(output);
}

</SCRIPT>

<FORM>
   <INPUT TYPE=button VALUE="Get state" onclick="getState()">
</FORM>

This example adds a button beneath the links on users' webtops. When a user clicks this button, Secure Global Desktop displays a short message indicating the current state of the terminal emulator applet.

Add the code to the HTML document containing the webtop tray applet (left.html, in the sco/tta/standard webtop theme), after the TTAAPPLET declaration.

Note This example assumes you're using the sco/tta/standard webtop theme. If you're using another theme, with different frame names and layouts, or different applet names, you'll need to modify the lines that invoke the getEmulatorState method to access the terminal emulator applet used by your new theme.

Related topics