Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter SeventeenApplication Integration Functions (continued)

17.8 Edit Window Functions

17.8.1 Overview

The supporting application can have one or more edit windows open, each view can also have views. For example, a Page View edit window will have two windows, Code View and Page View.

Every MDI Edit Window will have an underlying Mapped Text Object and can be accessed (in varying degrees) via an Edit Object which is associated with each view. The window type information has bits that describe the capabilities of various views. For example, whether the view is row column cell addressable or X/Y character line addressable. The GetEditWindowType function can be used to determine the type and capabilities of a window. Generally, a script will be associated with a specific view type and it may not be necessary to check the actual type.

The Edit Manager is used to track all the MDI windows in the application (Information and Management Views are tracked separately). The chart below is a logical representation of the relationship between the Edit Manager, MDI Edit Windows and their components:

The Edit Manager tracks the main MDI Window (container), each of up to 512 edit views and their associated Mapped Text Object. The application Frame Manager and each window manage the visual presentation of the windows. As MDI Edit Windows are closed, the slots in the Edit Manager table are not shifted but rather just empty (“open slot” as shown above). Therefore, an application that has been open for some time with a number of files being opened and closed can have empty positions. Edit Manager slots are addressed by an edit window index.

Only one MDI Edit Window can be active at any time and only one view may have keyboard focus. The GetActiveEditWindow function can be used to retrieve the active (or last active) window.

17.8.2 Overview of Windows and Window Handles

There are four basic handles for edit windows: Window handles, Edit Object handles, Mapped Text Object and view specific handles.

Window handles are managed by the Windows operating system. While they are stored in the handle data type, they are effectively 32-bit unique numbers that identify a window in the operating system’s space. Generally, scripts do not need to access window handles except for referencing views. It is not necessary to close window handles. There are many functions that can be performed using these handles (some of which can be deleterious to the operation of the application) but in general, they are not important to edit functions. See Chapter 15 — Windows/OS Functions. Each MDI Edit Window can have dozens of handles for views, grips, scrollbars and other tools. Primarily, the MDI Edit Window (MDI container) and individual views are the handles of interest.

Edit Object handles allow for access at a high-level to the content of the window. The level of support depends on the view with Text View and Page View providing full support. This is the preferred method of address text based windows while the Data View and Data Sheet objects can be used for spreadsheet style views. Edit Objects are specific to views and can be referenced by functions such as GetEditObject. In most cases, any changes to the window are applied after the handle is closed.

The lowest level handle is for the Mapped Text Object associated with a set of views. For the one edit window, with multiple views, each view shares the same Mapped Text Object. Generally, it is not a good idea to perform low-level changes to the Mapped Text Object since all of the edit management (undo) and screen updating is performed by the Edit Object. However, the Mapped Text Object is used many times to access file data associated with a view. Certain functions, such as ReadLine, will take both an Edit and Mapped Text Object handle and operate in the same manner.

17.8.3 The Edit Manager

To manage all the windows within the application, a special class of functions called the Edit Manager is employed. Functions are provided to count windows (slots used) such as GetEditWindowCount and GetEditWindowLimit to get the total allowed windows.

The FindEditWindowView function can be used to find a specific window or the windows can be enumerated manually by using the GetEditWindowFilename and GetEditWindowHandle functions. The GetEditWindowHandle, can also be used to get handles to individual views.

A handle for the window’s Mapped Text Object can be retrieved using GetMappedTextObject and likewise, the Edit Object associated with a specific view using the GetEditObject function.

17.8.4 Function Overview

ActivateEditWindow — Activates an edit window and view (or default view).

EnumerateEditFiles — Enumerates a list of all or only modified titled edit windows and filenames.

EnumerateEditWindows — Enumerates a table all edit windows and their properties.

FindEditWindow — Returns an edit window index by locating a handle or filename.

FindEditWindowByAlias — Returns an edit window index by matching an alias name.

FindEditWindowView — Finds a view handle by name, index or handle.

GetActiveEditObject — Returns an Edit Object for the active edit window.

GetActiveEditWindow — Returns the handle to the active edit window.

GetEditWindowCount — Returns the number of open edit windows from the Edit Manager.

GetEditWindowFilename — Returns the window filename for windows managed by the Edit Manager.

GetEditWindowHandle — Gets the handle for a specific window client or view.

GetEditWindowLimit — Gets the number of edit window slots from the Edit Manager.

GetEditWindowType — Returns the window type code for windows managed by the Edit Manager.

GetEditObject — Gets an Edit Object and associates it with an edit window.

GetMappedTextObject — Gets the associated Mapped Text Object for an edit window.

EditWindowSetCaret — Sets the caret or cell position for an edit window.