Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SeventeenApplication Integration Functions (continued)

GetActiveEditWindow Function

Overview

The GetActiveEditWindow function returns the window handle to the active edit widow (view).

Syntax/Parameters

Syntax

handle = GetActiveEditWindow ( );

Parameters

(none)

 

Return Value

Returns a handle to the window or NULL_HANDLE on failure. Use the GetLastError function to retrieve error information.

Remarks

The return value is a Windows handle, which is managed by the Edit Manager and the operating system. It is not a handle to a managed Legato object. Window handles are assigned by the operating system and uniquely identify a window. These handles can be used to access information and perform various functions within Legato. Messages can also be directly sent to windows but programmers are cautioned that this is an advanced operation that requires understanding of Windows messaging dynamics. It is also possible to adversely affect the application by performing certain windows commands without working through published script functions. Window handle values are persistent as long as the window is open. If the window is closed and reopened, the handle value will change. Since a window handle is managed by Windows, it does not need to be closed, and if the CloseHandle function is called, it will essentially do nothing.

Note that the active edit window may be a child of the view window. Therefore, a script may have to get the parent if the handle is not correct.

Example

The following code could be part of a hook being called where the hook determines the current window type:

    hView = GetActiveEditWindow();
    if (IsError(hView)) {
      MessageBox('x', "No active view for operation");
      return ERROR_CONDITION;
      }
    w_type = GetEditWindowType(hView);
    if (IsError()) {
      hView = GetParentWindow(hView);
      w_type = GetEditWindowType(hView);
      }
    w_type &= EDX_TYPE_ID_MASK;
    if (w_type != EDX_TYPE_PSG_FORMS_VIEW) {
      MessageBox('x', "View is not correct type");
      return ERROR_CONDITION;
      }

If a view is not active (no MDI windows open), no handle is returned. 

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE