Siebel Object Interfaces Reference > Siebel Object Interfaces Reference > Object Interfaces Reference >

Control Methods


This topic describes control methods. It includes the following topics:

In this topic, the controlVar variable indicates the name of the control that causes Siebel CRM to call the method. For example, Button1_Click.

A control method does not work with an ActiveX control.

Applet Method for a Control

The Applet method returns a string that contains the name of the applet that contains the control.

Format

controlVar.Applet

No arguments are available.

Usage

Getting the name of the applet that contains the control allows you to configure Siebel CRM to do operations on the applet, not only on the control.

Used With

Browser Script

BusComp Method for a Control

The BusComp method returns a string that contains the name of the business component that an applet references. The control resides in this applet.

Format

controlVar.BusComp

No arguments are available.

Used With

Browser Script

Examples

For an example, see Name Method for a Business Component.

GetProperty Method for a Control

The GetProperty method returns a string that contains the value of a property. If the property does not exist, then this method returns NULL.

Format

controlVar.GetProperty(propName)

No arguments are available.

Usage

You can use the GetProperty method with the following controls:

  • CheckBox
  • ComboBox
  • TextBox
  • TextArea
  • Label

You can use the GetProperty method to get values for the following properties:

  • Background Color
  • Enabled
  • FontType
  • FontColor
  • FontSize
  • FontStyle
  • Height
  • Width
  • Read Only
  • Visible

For more information about these properties, see Table 91.

To return more than one property, you must use a separate statement for each property.

Used With

Browser Script

Examples

The following example uses the GetProperty method to return values for the FontSize, Background Color, Width, and Height properties:

theApplication().SWEAlert("checkbox.FontSize : " + objCheckBox.GetProperty("FontSize"));
theApplication().SWEAlert("checkbox.BgColor : " + objCheckBox.GetProperty("BgColor"));
theApplication().SWEAlert("checkbox.Width : " + objCheckBox.GetProperty("Width"));
theApplication().SWEAlert("checkbox.Height : " + objCheckBox.GetProperty("Height"));

GetValue Method for a Control

The GetValue method returns the value that a control displays for the data type of the field that the control references. The type of value depends on the specific control. This method returns the value in a string.

The GetValue method cannot return a literal value that a user provides as input to a control. This method returns the value that Siebel CRM stores for the user entry, according to the data type of the field that the control references.

Format

controlVar.GetValue

No arguments are available.

Usage

For more information, see Usage for the GetValue Method and the SetValue Method.

Used With

Browser Script

Examples

For an example, see Examples for the GetValue Method and the SetValue Method.

Name Method for a Control

The Name method for a control returns a string that contains the name of a control.

Format

controlVar.Name

No arguments are available.

Used With

Browser Script

Examples

For an example, see Name Method for a Business Component.

SetLabelProperty Method for a Control

The SetLabelProperty method sets the properties of a label. This method does not return any information.

Format

controlVar.SetLabelProperty(propName, propValue)

Table 90 describes the arguments for the SetLabelProperty method.

Table 90. Arguments for the SetLabelProperty Method
Argument
Description

propName

The name of the property that Siebel CRM must set. For a description of the values you can enter, see Properties You Can Set For a Label.

propValue

The value to set for the property. For a description of the values you can enter, see Properties You Can Set For a Label.

Usage

If you must set more than one property, then you must use a separate statement for each property.

Enabling the SetLabelProperty Method

Siebel CRM does not enable the SetLabelProperty method by default. You must enable it in Siebel Tools before you use it in a script.

To enable the SetLabelProperty method

  1. Open Siebel Tools.
  2. Display the Control User Prop object type:
    1. Choose the View menu, and then the Options menu item.
    2. Click the Object Explorer tab.
    3. Scroll down through the Object Explorer Hierarchy window until you locate the Applet tree.
    4. Expand the Applet tree, expand the Control tree, and then make sure the Control User Prop object type includes a check mark.
    5. Click OK.
  3. In the Object Explorer, click Applet.
  4. In the Applets list, locate the applet that includes the control you must modify.
  5. In the Object Explorer, expand the Applet tree, and then click Control.
  6. In the Controls list, locate the control you must modify.
  7. In the Object Explorer, expand the Control tree, and then click Control User Prop.
  8. In the Control User Props list, add a new control user property using values from the following table.
    Property
    Value

    Name

    useLabelID

    Value

    TRUE

Properties You Can Set For a Label

Table 91 lists the properties you can set for a label.

Table 91. Properties You Can Set For a Label
Property
Value
Description

BgColor

string

Determines the background color for a label. For example:

  • Red is #ff0000.
  • Green is #00ff00.
  • Blue is #0000ff.

FontColor

string

Determines the font color for a label. For example, green is #00ff00.

FontType

string

Determines the font type for a label. For example, Times Roman.

FontSize

string

Determines the font size for a label. For example, 12 pt.

FontStyle

string

Determines the font style for a label. For example, italic.

FontWeight

string

Determines the font weight for a label. You can use the following values:

  • bold
  • bolder
  • lighter
  • normal
  • 100, 200, 300, or 400. These values are equivalent to light.
  • 500, 600, or 700. These values are equivalent to normal.
  • 800 or 900. These values are equivalent to bold.

The default value is normal.

Height

string

Determines height for a label, in pixels. For example, 5.

Visible

visible or hidden

Determines if the label is visible. The default value is the value in the Siebel repository file (SRF).

Width

string

Determines the width for a label, in pixels. For example, 80.

Used With

Browser Script

Examples

The following code uses the SetLabelProperty method:

function Applet_PreInvokeMethod (name, inputPropSet){

switch (name) {

// Example of changing the font size of the Location label
case ("fontsize"):
{

var ctl = this.FindControl("Location");
var fSize = prompt("Specify the required label font size (numeric value only).");
ctl.SetLabelProperty("FontSize", fSize);
return ("CancelOperation");

}

// Example of changing the background color of the Location label
case ("bgcolor"):
{

var ctl = this.FindControl("Location");
var bgColor = prompt("Specify th ebackground color of the label. Enter a valid six hexadecimal digit RGB value preceded by #");
ctl.SetLabelProperty("BgColor", bgColor);
return ("CancelOperation");

}

// Example of changing the font type of the Location label
case ("fonttype"):
{

var ctl = this.FindControl("Location");
var fontType =prompt("Specify the font type for the label.");
ctl.SetLabelProperty("FontType", fontType);
return ("CancelOperation");

}

// Example of changing the font color of the Location label
case ("fontcolor"):
{

var ctl = this.FindControl("Location");
var fontColor = prompt("Specify the font color of the label. Enter a valid six hexadecimal digit RGB value preceded by #");
ctl.SetLabelProperty("FontColor", fontColor);
return ("CancelOperation");

}

break;

}

}

SetProperty Method for a Control

The SetProperty method sets the properties of a control. This method does not return any information.

Format

controlVar.SetProperty(propName, propValue)

Table 92 describes the arguments for the SetProperty method.

Table 92. Arguments for the SetProperty Method
Argument
Description

propName

The name of the property that Siebel CRM must set. For a description of the values you can enter, see Properties You Can Set for a Control.

propValue

The value that Siebel CRM must set for the property. For a description of the values you can enter, see Properties You Can Set for a Control.

Usage

You can use the SetProperty method with the following controls:

  • CheckBox
  • ComboBox
  • TextBox
  • TextArea

If you must set more than one property, then you must use a separate statement to set each property.

Properties You Can Set for a Control

Table 93 describes the properties you can set for a control.

Table 93. Properties You Can Set for a Control
Property
Value
Description

Enabled

TRUE or FALSE

Determines if the control is active. The default value is the value in the Siebel repository file (SRF).

Shown

TRUE or FALSE

Determines if Siebel CRM displays the control. The default value is the value in the Siebel repository file (SRF).

ReadOnly

TRUE or FALSE

Determines if the control is read-only. The default value is the value in the Siebel repository file (SRF).

BgColor

To modify these control properties, you can use these same properties you use to modify a label. For a description of the values you can enter, see Properties You Can Set For a Label.

FontColor

FontType

FontSize

FontStyle

FontWeight

Height

Visible

Width

Used With

Browser Script

Using the SetProperty Method to Control Font Weight

To use the SetProperty method to control font weight, you must use the FontWeight property. For example:

control.SetProperty("FontWeight","600")

You cannot use the FontStyle argument to control font weight. For example, the following code fails:

control.SetProperty("FontStyle", "Bold")

Examples

The following code uses the SetProperty method:

objCheckBox.SetProperty("FontColor", "#00ff00");
objCheckBox.SetProperty("FontStyle", "italic");
objCheckBox.SetProperty("FontType", "Verdana");
objCheckBox.SetProperty("FontSize", "14 pt");
objCheckBox.SetProperty("BgColor", "#00f000");
objCheckBox.SetProperty("Width", "100");
objCheckBox.SetProperty("Height", "100");

SetValue Method for a Control

The SetValue method sets the contents a control. This method does not return any information.

Format

controlVar.SetValue (controlValue)

Table 94 describes the arguments for the SetValue method.

Table 94. Arguments for the SetValue Method
Argument
Description

controlValue

String that contains the value that Siebel CRM must set for the control.

Usage for the GetValue Method and the SetValue Method

Note the following usage for the SetValue method:

  • This method does not validate the format of the data. Data validation occurs when the user steps off the field or the record, or explicitly saves the record.
  • This method can set the value for a read-only control, but Siebel CRM does not save this information when the user saves the record.
  • The user can modify the contents of a control before Siebel CRM saves control information to the business component field.

Note the following usage for the GetValue method and the SetValue method:

  • These methods only work on form applets.
  • These methods work only for a control that references a business component field.
  • You cannot use these methods with a label.
Used With

Browser Script

Examples for the GetValue Method and the SetValue Method

The following code uses the GetValue method and the SetValue method:

function Applet_PreInvokeMethod (name, inputPropSet)
{

switch (name) {

// Example of changing the value of the Abstract control to uppercase
case ("SR Abstract"):
{

var ctlName = "Abstract";
var ctl = this.FindControl(ctlName);
var ctlVal = ctl.GetValue();
ctl.SetValue(ctlVal.toUpperCase());
ctl= null;
return("CancelOperation");

}

// Example of changing the value of a checkbox control
case ("SR Billable"):
{

var ctlName = "Billable Flag";
var ctl = this.FindControl(ctlName);
var ctlVal = ctl.GetValue();
if (ctlVal == "Y")
   ctl.SetValue("N"); // clear the box
else
   ctl.SetValue("Y"); // check the box
ctl= null;
return("CancelOperation");

}

// Example of changing the value of a date/time control
case ("SR Commit time"):
{

var ctlName = "Agent Committed";
var ctl = this.FindControl(ctlName);
ctl.SetValue("12/1/2001 1:09:31 AM");
// format is not validated until user saves the record
ctl= null;
return("CancelOperation");

}

break;

}

}

Siebel Object Interfaces Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.