IsRadioCheck Property (MenuItem Objects)

Applies to TestComplete 14.91, last modified on July 20, 2021

Description

Use the IsRadioCheck property to find out whether the specified menu item is checkable.

Declaration

TestObj.IsRadioCheck

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 checkable, and False otherwise.

Example

The following code snippet iterates through the items of Windows Notepad's main menu and determines whether the items are checkable.

JavaScript, JScript

function MenuItemSample()
{
  var Notepad, Window, MainMenu, Item;
  // Obtains Windows Notepad's main menu
  Notepad = Sys.Process("Notepad");
  Window = Notepad.Window("Notepad", "*");
  MainMenu = Window.MainMenu;

  // Iterates through the main menu items
  // And determines whether the items are checkable
  for (var i = 0; i < MainMenu.Count; i++)
  {
    Item = MainMenu.Items(i);

    if (Item.IsRadioCheck)
      Log.Message("The " + Item.Caption + " menu item is checkable");
    else
      Log.Message("The " + Item.Caption + " menu item is uncheckable");

  }

}

Python

def MenuItemSample():
  # Obtains Windows Notepad's main menu
  Notepad = Sys.Process("Notepad")
  Window = Notepad.Window("Notepad", "*")
  MainMenu = Window.MainMenu

  # Iterates through the main menu items
  # And determines whether the items are checkable
  for i in range (0, MainMenu.Count):
    Item = MainMenu.Items[i]

    if (Item.IsRadioCheck):
      Log.Message("The " + Item.Caption + " menu item is checkable")
    else:
      Log.Message("The " + Item.Caption + " menu item is uncheckable")

VBScript

Sub MenuItemSample

  ' Obtains Windows Notepad's main menu
  Set Notepad = Sys.Process("Notepad")
  Set Window = Notepad.Window("Notepad", "*")
  Set MainMenu = Window.MainMenu

  ' Iterates through the main menu items
  ' And determines whether the items are checkable
  For i = 0 To MainMenu.Count - 1
    Set Item = MainMenu.Items(i)

    If Item.IsRadioCheck Then
      Log.Message "The " & Item.Caption & " menu item is checkable"
    Else
      Log.Message "The " & Item.Caption & " menu item is uncheckable"
    End If

  Next

End Sub

DelphiScript

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

  // Iterates through the main menu items
  // And determines whether the items are checkable
  for i := 0 to MainMenu.Count -1 do
  begin
    Item := MainMenu.Items[i];

    if Item.IsRadioCheck then
      Log.Message('The ' + Item.Caption + ' menu item is checkable')
    else
      Log.Message('The ' + Item.Caption + ' menu item is uncheckable');

  end;

end;

C++Script, C#Script

function MenuItemSample()
{
  var Notepad, Window, MainMenu, Item;
  // Obtains Windows Notepad's main menu
  Notepad = Sys["Process"]("Notepad");
  Window = Notepad["Window"]("Notepad", "*");
  MainMenu = Window["MainMenu"];

  // Iterates through the main menu items
  // And determines whether the items are checkable
  for (var i = 0; i < MainMenu.Count; i++)
  {
    Item = MainMenu["Items"](i);

    if (Item["IsRadioCheck"])
      Log["Message"]("The " + Item.Caption + " menu item is checkable");
    else
      Log["Message"]("The " + Item.Caption + " menu item is uncheckable");

  }

}

See Also

Checking Menu Item's State
Checked Property (MenuItem Objects)
IsBitmap Property (MenuItem Objects)
IsOwnerdraw Property (MenuItem Objects)
IsSeparator Property (MenuItem Objects)

Highlight search results