LibWindowByID Method

Searches for a library window with the specified ID (the ID property) in the window collection of the application. Returns an instance of the Window object, that corresponds to the found library window.

Applies to: Application object

Syntax

[[Set] libWndRet =] object.LibWindowByID ( libWindowID )

The LibWindowByID method syntax has these parts:

Part Description
object Required. An expression, that returns an instance of the Application object.

libWindowID

Required. An expression that returns a Long value. The ID of the library window being searched.

libWndRet Optional. A Window type variable.

Remarks

If there is no library window with the specified libWindiwID in the window collection of the document, the LibWindowByID method returns Nothing.

Example

This example contains a application-level script. The isLibWnd function employs the LibWindowByID method and is used to determine whether the specified window is a library window.

' The function checks whether the window with the specified ID
' is a library window.
Function isLibWnd( wnd As Window )
    if thisApp.LibWindowByID( wnd.ID ) <> Null Then
        isLibWnd = True
    Else
        isLibWnd = False
    End If
End Function

' Declare variables
Dim l_wnd As Window
Dim d_wnd As Window

' Get first library window
Set l_wnd = thisApp.FirstLibWindow()

' Get second library window
Set d_wnd = thisApp.Doc(1).FirstView()

' Disply the results of 
' the isLibWnd function for l_wnd and d_wnd
TRACE isLibWnd( l_wnd )
TRACE isLibWnd( d_wnd )

At least one library and one documents must be open for this example to work correctly. As the result, the following will be displayed:

TRUE
FALSE

 

See Also

ID property, FirstLibWindow method, LibWindowsNum method, NextLibWindow method, Window object