Microsoft Scriptlet TechnologyMicrosoft Scriptlet Technology*
*Contents  *Index  *Topic Contents

Using Default Interface Descriptions

If there is no Public_Description object defined in the scriptlet, the scriptlet container object exposes properties and methods using variables and functions in the scriptlet that follow certain naming conventions. To expose scriptlet properties and methods, use these conventions:

Note   When a property or method is exposed, its name in the host application does not have the public_ prefix. For example, if you define a property called public_MyTitle in the scriplet, its name in the host application is MyTitle.

The following table shows examples of variables and functions in a scriptlet, and the resulting interface that they expose in the host application.

ExampleExposed AsUsed in container
var public_Color = "red"
Property
vColor = SC1.Color SC1.Color = "blue"
function public_look(param)
Method
SC1.look(param)
function public_get_C()
Property (read)
x = SC1.C
function public_put_C(param)
Property (write)
SC1.C = "test"
function look()
Not available
(no public_ prefix)
function get_C()
Not available
(no public_ prefix)
var Color = red;
Not available
(no public_ prefix)
var get_Color = red;
Not available
(no public_ prefix)

For example, the following example shows a portion of a page containing a paragraph named "P1." The script block following the paragraph exposes a property called P1Text and a method called SetText.

<P ID=P1>This is a paragraph of text.</P>

<SCRIPT LANGUAGE="JavaScript">
<!--
public_P1Text = P1.innerText
function public_SetText(newText){
   P1.innerText = newText;
}
// -->
</SCRIPT>

The scriptlet reserves the function name prefixes public_get_ and public_put_ to define properties. For example, if the scriptlet contains a function named public_get_MyText, it will be treated as a property called MyText. If you attempt to call the function public_get_MyText as a method using the syntax SC1.get_MyText(), an error will result, because the function itself is exposed only as if it were a property named MyText.

See Also

Creating a Public_Description Object

Handling Standard Events

Defining Custom Events

Adding Scriptlets to Your Application


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.