HasRetValue Method

Applies to TestComplete 15.31, last modified on March 17, 2022

Description

Use the HasRetValue property to determine whether the method has a return value.

Declaration

aqObjMethodObj.HasRetValue()

aqObjMethodObj An expression, variable or parameter that specifies a reference to an aqObjMethod object
Result Boolean

Applies To

The method is applied to the following object:

Result Value

True if the method has a return value; False otherwise.

Example

The code below checks whether the Click method has a return value.

JavaScript, JScript

function HasRetValue()
{

  // Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var Method = aqObject.GetMethods(Obj).Item(1);
  
  if ( Method.HasRetValue() )
    Log.Message("The specified method has a return value.")
  else 
    Log.Message("The specified method does not have a return value.");
  
  // Closes notepad.exe
  Sys.Process("notepad").Terminate();
   
}

Python

def HasRetValue():
  # Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL)
  # Specifies the object
  Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  # Obtains information about the Click method
  Method = aqObject.GetMethods(Obj).Item(1)
  if Method.HasRetValue():
    Log.Message("The specified method has a return value.")
  else:
    Log.Message("The specified method does not have a return value.")
  # Closes notepad.exe
  Sys.Process("notepad").Terminate()

VBScript

Sub HasRetValue

  ' Launches notepad.exe
  Call WshShell.Run("notepad.exe", SW_NORMAL)
  
  ' Specifies the object
  Set Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  
  ' Obtains information about the Click method
  Set Method = aqObject.GetMethods(Obj).Item(1)
  
  If Method.HasRetValue Then
    Log.Message "The specified method has a return value."
  Else 
    Log.Message "The specified method does not have a return value."
  End If
  
 ' Closes notepad.exe
  Sys.Process("notepad").Terminate
   
End Sub

DelphiScript

function HasRetValue;
var Obj, Method;
begin

  // Launches notepad.exe
  WshShell.Run('notepad.exe', SW_NORMAL);
  
  // Specifies the object
  Obj := Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1);
  
  // Obtains information about the Click method
  Method := aqObject.GetMethods(Obj).Item(1);
  
  if ( Method.HasRetValue() ) then
    Log.Message('The specified method has a return value.')
  else 
    Log.Message('The specified method does not have a return value.');
  
  // Closes notepad.exe
  Sys.Process('notepad').Terminate();
   
end;

C++Script, C#Script

function HasRetValue()
{

  // Launches notepad.exe
  WshShell["Run"]("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var Method = aqObject["GetMethods"](Obj)["Item"](1);
  
  if ( Method["HasRetValue"]() )
    Log["Message"]("The specified method has a return value.")
  else 
    Log["Message"]("The specified method does not have a return value.");
  
  // Closes notepad.exe
  Sys["Process"]("notepad")["Terminate"]();
   
}

See Also

Name Property
ParamCount Property
ParamName Property
ParamType Property
ValueType Property

Highlight search results