Indicator.Clear Method

Applies to TestComplete 15.40, last modified on July 05, 2022

Description

When you set the indicator text using the PushText method, the old indicator text is not removed, but stored to the internal stack so that you can easily restore the text later via PopText. The Clear method removes all of the strings from the stack and reverts the indicator text to the default one.

Note that the indicator text can be changed by your scripts or by TestComplete. Clear only removes user strings. It does not touch the TestComplete values.

Declaration

Indicator.Clear()

Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The code below demonstrates how you can set, restore and obtain the text that is shown under the indicator's icon.

JavaScript, JScript

function IndicatorDemo()
{
  // Shows the indicator icon
  Indicator.Show();
  // Pushes text to the indicator
  Indicator.PushText("Hello!");
  // Delays the script execution for 2 seconds
  aqUtils.Delay(2000, Indicator.Text);
  
  // Pushes new text to the indicator
  Indicator.PushText("New indicator text.");
  aqUtils.Delay(2000, Indicator.Text);
  
  // Restores the previous indictor text - "Hello!"
  Indicator.PopText();
  aqUtils.Delay(2000, Indicator.Text);
  
  // Clears the history of the indicator's user messages
  Indicator.Clear();
  
  // Hides the indicator icon
  Indicator.Hide();
}

Python

def IndicatorDemo():
  # Shows the indicator icon
  Indicator.Show()
  # Pushes text to the indicator
  Indicator.PushText("Hello!")
  # Delays the script execution for 2 seconds
  aqUtils.Delay(2000, Indicator.Text)
  # Pushes new text to the indicator 
  Indicator.PushText("New indicator text.")
  aqUtils.Delay(2000, Indicator.Text)
  # Restores the previous indictor text - "Hello!"
  Indicator.PopText()
  aqUtils.Delay(2000, Indicator.Text)
  # Clears the history of the indicator's user messages
  Indicator.Clear()
  # Hides the indicator icon
  Indicator.Hide()

VBScript

Sub IndicatorDemo()

  ' Shows the indicator icon
  Indicator.Show()
  ' Pushes text to the indicator
  Indicator.PushText("Hello!")
  ' Delays the script execution for 2 seconds
  Call aqUtils.Delay(2000, Indicator.Text)
  
  ' Pushes new text to the indicator
  Indicator.PushText("New indicator text.")
  Call aqUtils.Delay(2000, Indicator.Text)
  
  ' Restores the previous indictor text - "Hello!"
  Indicator.PopText()
  Call aqUtils.Delay(2000, Indicator.Text)
  
  ' Clears the history of the indicator's user messages
  Indicator.Clear()
  
  ' Hides the indicator icon
  Indicator.Hide()

End Sub

DelphiScript

function IndicatorDemo;
begin

  // Shows the indicator icon
  Indicator.Show;
  // Pushes text to the indicator
  Indicator.PushText('Hello!');
  // Delays the script execution for 2 seconds
  aqUtils.Delay(2000, Indicator.Text);
  
  // Pushes new text to the indicator
  Indicator.PushText('New indicator text.');
  aqUtils.Delay(2000, Indicator.Text);
  
  // Restores the previous indictor text - "Hello!"
  Indicator.PopText;
  aqUtils.Delay(2000, Indicator.Text);
  
  // Clears the history of the indicator's user messages
  Indicator.Clear;
  
  // Hides the indicator icon
  Indicator.Hide;

end;

C++Script, C#Script

function IndicatorDemo()
{
  // Shows the indicator icon
  Indicator["Show"]();
  // Pushes text to the indicator
  Indicator["PushText"]("Hello!");
  // Delays the script execution for 2 seconds
  aqUtils["Delay"]( 2000, Indicator["Text"] );
  
  // Pushes new text to the indicator
  Indicator["PushText"]("New indicator text.");
  aqUtils["Delay"]( 2000, Indicator["Text"] );
  
  // Restores the previous indictor text - "Hello!"
  Indicator["PopText"]();
  aqUtils["Delay"]( 2000, Indicator["Text"] );
  
  // Clears the history of the indicator's user messages
  Indicator["Clear"]();
  
  // Hides the indicator icon
  Indicator["Hide"]();
}

See Also

Indicator Object
PushText Method
PopText Method
Text Property

Highlight search results