Description
Specifies whether the object appears on screen.
Declaration
TestObj.Visible
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
All onscreen objects.
View Mode
This property is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.
Property Value
True if the object is visible to users, otherwise False.
Remarks
-
Visible
property returns True for Enabled controls that are invisible (have Opacity set to 0). -
When testing Qt applications, use
NativeQtObject.visible
to determine if the object appears on screen. For detailed information see Using Namespaces.
Example
The following example demonstrates how to use Visible
property in scripts:
JavaScript, JScript
function SearchCharacter()
{
var proc, dlgCharacterMap, checkAdvancedView, editSearchFor;
// Launch charmap.exe
WshShell.Run("charmap.exe");
proc = Sys.Process("charmap");
dlgCharacterMap = proc.Window("#32770", "Character Map");
checkAdvancedView = dlgCharacterMap.Window("Button", "Ad&vanced view");
editSearchFor = dlgCharacterMap.Window("Edit", "", 2);
// Activate the advanced view if the search box is invisible
if (editSearchFor.Visible == false)
{
Log.Message("The search box is invisible.");
checkAdvancedView.ClickButton(cbChecked);
}
// Search for the character
editSearchFor.Keys("A");
dlgCharacterMap.Window("Button", "Sea&rch").ClickButton();
}
Python
def SearchCharacter():
# Launch charmap.exe
WshShell.Run("charmap.exe")
proc = Sys.Process("charmap")
dlgCharacterMap = proc.Window("#32770", "Character Map")
checkAdvancedView = dlgCharacterMap.Window("Button", "Ad&vanced view")
editSearchFor = dlgCharacterMap.Window("Edit", "", 2)
# Activate the advanced view if the search box is invisible
if editSearchFor.Visible == False :
Log.Message("The search box is invisible.")
checkAdvancedView.ClickButton(cbChecked)
# Search for the character
editSearchFor.Keys("A")
dlgCharacterMap.Window("Button", "Sea&rch").ClickButton()
VBScript
Sub SearchCharacter
Dim proc, dlgCharacterMap, checkAdvancedView, editSearchFor
' Launch charmap.exe
Call WshShell.Run("charmap.exe")
Set proc = Sys.Process("charmap")
Set dlgCharacterMap = proc.Window("#32770", "Character Map")
Set checkAdvancedView = dlgCharacterMap.Window("Button", "Ad&vanced view")
Set editSearchFor = dlgCharacterMap.Window("Edit", "", 2)
' Activate the advanced view if the search box is invisible
If (editSearchFor.Visible = false) Then
Log.Message("The search box is invisible.")
checkAdvancedView.ClickButton(cbChecked)
End If
' Search for the character
editSearchFor.Keys("A")
dlgCharacterMap.Window("Button", "Sea&rch").ClickButton()
End Sub
DelphiScript
function SearchCharacter;
var proc, dlgCharacterMap, checkAdvancedView, editSearchFor;
begin
// Launch charmap.exe
WshShell.Run('charmap.exe');
proc := Sys.Process('charmap');
dlgCharacterMap := proc.Window('#32770', 'Character Map');
checkAdvancedView := dlgCharacterMap.Window('Button', 'Ad&vanced view');
editSearchFor := dlgCharacterMap.Window('Edit', '', 2);
// Activate the advanced view if the search box is invisible
if editSearchFor.Visible = false then
begin
Log.Message('The search box is invisible.');
checkAdvancedView.ClickButton(cbChecked);
end;
// Search for the character
editSearchFor.Keys('A');
dlgCharacterMap.Window('Button', 'Sea&rch').ClickButton();
end;
C++Script, C#Script
function SearchCharacter()
{
var proc, dlgCharacterMap, checkAdvancedView, editSearchFor;
// Launch charmap.exe
WshShell["Run"]("charmap.exe");
proc = Sys["Process"]("charmap");
dlgCharacterMap = proc["Window"]("#32770", "Character Map");
checkAdvancedView = dlgCharacterMap["Window"]("Button", "Ad&vanced view");
editSearchFor = dlgCharacterMap["Window"]("Edit", "", 2);
// Activate the advanced view if the search box is invisible
if (editSearchFor["Visible"] == false)
{
Log["Message"]("The search box is invisible.");
checkAdvancedView["ClickButton"](cbChecked);
}
// Search for the character
editSearchFor["Keys"]("A");
dlgCharacterMap["Window"]("Button", "Sea&rch")["ClickButton"]();
}
See Also
Enabled Property
VisibleOnScreen Property
Focused Property (Window and BrowserWindow Objects)