IsOwnerdraw Property (MenuItem Objects)

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

Description

The IsOwnerdraw property returns True, if the menu item is an ownerdraw one. Otherwise - False. As ownerdraw items may hold no text, you should use their indexes when working with them.

Declaration

TestObj.IsOwnerdraw

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 an ownerdraw one; Otherwise - False.

Example

The following code snippet obtains a menu item and determines whether the item is an ownerdraw item.

JavaScript, JScript

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

  // Determines whether the menu item is an ownerdraw item
  if (EditItem.IsOwnerdraw)
    Log.Message("The Edit menu item is an ownerdraw item");

}

Python

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

  # Determines whether the menu item is an ownerdraw item
  if (EditItem.IsOwnerdraw):
    Log.Message("The Edit menu item is an ownerdraw item")

VBScript

Sub MenuItemSample

  ' Obtains the Windows Notepad main menu
  Set MainMenu = Sys.Process("Notepad").Window("Notepad", "*").MainMenu
  ' Obtains the Edit menu item
  Set EditItem = MainMenu.Items("Edit")

  ' Determines whether the menu item is an ownerdraw item
  If EditItem.IsOwnerdraw Then
    Log.Message "The Edit menu item is an ownerdraw item"
  End If

End Sub

DelphiScript

procedure MenuItemSample();
var MainMenu, EditItem;
begin
  // Obtains the Windows Notepad main menu
  MainMenu := Sys.Process('Notepad').Window('Notepad', '*').MainMenu;
  // Obtains the Edit menu item
  EditItem := MainMenu.Items('Edit');

  // Determines whether the menu item is an ownerdraw item
  if EditItem.IsOwnerdraw then
    Log.Message('The Edit menu item is an ownerdraw item');

end;

C++Script, C#Script

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

  // Determines whether the menu item is an ownerdraw item
  if (EditItem["IsOwnerdraw"])
    Log["Message"]("The Edit menu item is an ownerdraw item");

}

See Also

Working With Owner-Drawn and Bitmap Menus in Desktop Windows Applications
IsBitmap Property (MenuItem Objects)
IsRadioCheck Property (MenuItem Objects)
IsSeparator Property (MenuItem Objects)

Highlight search results