Secure Global Desktop Administration Guide > Applets > getProperty (X emulator applet)

getProperty (X emulator applet)

Syntax

string getProperty(window, property)

Description

The getProperty method returns the value of a particular X property associated with an X window on the application server.

window is the name of the X window whose properties you're interested in. (This name is contained in the X window's WM_NAME X property.) Use an empty string ("") to specify the root window.

property is the name of the X property whose value this method returns. For example, the WM_COMMAND X property contains the command used to start the application that the X window is displaying.

Note You can only use this method to get the values of X properties you have previously registered an interest in (using the registerProperty method). If you try to retrieve a property's value without first registering it, getProperty returns null.

This method can only retrieve the values of X properties of type STRING. If you use the method to retrieve a value for an X property of another type, the method returns null.

Examples

<SCRIPT LANGUAGE="JavaScript">

function showProperty() {
   var XEmulatorApplet = document.applets["Tarantella X Emulator"];
   var value = null;

   // Register an interest in the property WM_COMMAND

   XEmulatorApplet.registerProperty("xterm", "WM_COMMAND");
   
   // Keep trying to retrieve the X property value. 
   // It takes a finite amount of time to register the property. Until
   // the property is registered, getProperty() returns NULL. 

   var loop=0;

   while (value == null) {
      value = XEmulatorApplet.getProperty("xterm", "WM_COMMAND");
      loop++;
      if ( loop > 10000 ) break;
   }

   // Output either the value of the property, or an error message

   if (value != null) {
       alert("The X property WM_COMMAND has the value " + value);
   } else {
       alert("Couldn't access the X property WM_COMMAND");
   }

   // Unregister the X property

   XEmulatorApplet.unregisterProperty("xterm", "WM_COMMAND");
}

</SCRIPT>
 
<FORM>
 <INPUT TYPE=button VALUE="Get Property Value" onclick="showProperty()">
</FORM>

This example adds a button beneath the X emulator applet. When a user clicks the button, Secure Global Desktop displays the value of the X property WM_COMMAND associated with the X window whose name is xterm.

Note This example assumes the window name is xterm. You will need to change the code if you're using a different window name. This example also uses the X emulator applet's registerProperty and unregisterProperty methods to retrieve the property value.

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

Related topics