Secure Global Desktop Administration Guide > Applets > setProperty (X emulator applet)
void setProperty(window, property, value)
The setProperty
method sets the value of a particular
X property associated with an X window on the application server. If
the X property doesn't already exist, this method creates it.
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 sets.
value is the value you want to give to the specified X property.
This method can only set the values of X properties of type
STRING
. If you use the method to specify a value for an X
property of another type, its type is changed to STRING
.
Note Unlike the getProperty
method,
you don't need to register a property in
order to change its value with setProperty
.
<SCRIPT LANGUAGE="JavaScript"> function setProperty() { var XEmulatorApplet = document.applets["Tarantella X Emulator"]; // Get the value of the X Property text box XPropertyName = document.userInput.xproperty.value; // Get the value of the Value text box XPropertyValue = document.userInput.val.value; // Set the specified X property to the specified value XEmulatorApplet.setProperty("xterm", XPropertyName, XPropertyValue); } function getProperty() { var XEmulatorApplet = document.applets["Tarantella X Emulator"]; var value = null; // Get the value of the X Property text box XPropertyName = document.userInput.xproperty.value; // Register an interest in the specified X property XEmulatorApplet.registerProperty("xterm", XPropertyName); // 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", XPropertyName); loop++; if ( loop > 10000 ) break; } // Display the X property's value in the Value text box document.userInput.val.value = value; } </SCRIPT> <FORM name="userInput"> <p>X Property: <INPUT TYPE=text name=xproperty value=WM_COMMAND> <p>Value: <INPUT TYPE=text name=val value=null> <p><INPUT TYPE=button VALUE="Set X Property" onclick="setProperty()"> <INPUT TYPE=button VALUE="Get X Property" onclick="getProperty()"> </FORM>
This example adds two text boxes and two buttons beneath the X emulator applet:
Note This example assumes the window name is xterm
.
You will need to change the code if you're using a different window name.
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.
Copyright © 1997-2005 Sun Microsystems, Inc. All rights reserved.