IsSeparator Property (MenuItem Objects)

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

The IsSeparator property returns True if the menu item is a separator; otherwise - False.

Declaration

TestObj.IsSeparator

Read-Only Property Boolean
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section

Applies To

The property is applied to the following object:

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Property Value

True, if the menu item is a separator; otherwise - False.

Example

The following code snippet obtains the File menu of Windows Notepad, iterates through the menu items and posts the positions of the separator items to the test log.

JavaScript, JScript

function MenuItemSample()
{
  var MainMenu, FileMenu;
  // Obtains the Windows Notepad main menu
  MainMenu = Sys.Process("Notepad").Window("Notepad", "*").MainMenu;
  // Obtains the File menu
  FileMenu = MainMenu.Items("File").SubMenu;

  // Posts the indexes of the separator items to the test log
  for (var i = 0; i < FileMenu.Count; i++)
  {
    Item = FileMenu.Items(i);
    if (Item.IsSeparator)
      Log.Message("The File menu item with the " + aqConvert.IntToStr(i) + " index is a separator")
  }

}

Python

def MenuItemSample():
  # Obtains the Windows Notepad main menu
  MainMenu = Sys.Process("Notepad").Window("Notepad", "*").MainMenu
  # Obtains the File menu
  FileMenu = MainMenu.Items["File"].SubMenu

  # Posts the indexes of the separator items to the test log
  for i in range (0, FileMenu.Count):
    Item = FileMenu.Items[i]
    if (Item.IsSeparator):
      Log.Message("The File menu item with the " + aqConvert.IntToStr(i) + " index is a separator")

VBScript

Sub MenuItemSample
  ' Obtains the Windows Notepad main menu
  Set MainMenu = Sys.Process("Notepad").Window("Notepad", "*").MainMenu
  ' Obtains the File menu
  Set FileMenu = MainMenu.Items("File").SubMenu

  ' Posts the indexes of the separator items to the test log
  For i = 0 To FileMenu.Count - 1
    Set Item = FileMenu.Items(i)
    If Item.IsSeparator Then
      Log.Message "The File menu item with the " & aqConvert.IntToStr(i) & " index is a separator"
    End If
  Next

End Sub

DelphiScript

procedure MenuItemSample();
var
  MainMenu, FileMenu, Item : OleVariant;
  i : integer;
begin
  // Obtains the Windows Notepad main menu
  MainMenu := Sys.Process('Notepad').Window('Notepad', '*').MainMenu;
  // Obtains the File menu
  FileMenu := MainMenu.Items('File').SubMenu;

  // Posts the indexes of the separator items to the test log
  for i := 0 to FileMenu.Count - 1 do
  begin
    Item := FileMenu.Items[i];
    if Item.IsSeparator then
      Log.Message('The File menu item with the ' + aqConvert.IntToStr(i) + ' index is a separator')
  end;

end;

C++Script, C#Script

function MenuItemSample()
{
  var MainMenu, FileMenu;
  // Obtains the Windows Notepad main menu
  MainMenu = Sys["Process"]("Notepad")["Window"]("Notepad", "*")["MainMenu"];
  // Obtains the File menu
  FileMenu = MainMenu["Items"]("File")["SubMenu"];

  // Posts the indexes of the separator items to the test log
  for (var i = 0; i < FileMenu["Count"]; i++)
  {
    Item = FileMenu["Items"](i);
    if (Item["IsSeparator"])
      Log["Message"]("The File menu item with the " + aqConvert["IntToStr"](i) + " index is a separator")
  }

}

See Also

Checking Menu Item's State in Desktop Windows Applications
Enabled Property (MenuItem Objects)
IsBitmap Property (MenuItem Objects)
IsOwnerdraw Property (MenuItem Objects)
IsRadioCheck Property (MenuItem Objects)

Highlight search results