All Manuals > CAPI User Guide and Reference Manual > 7 Programming with CAPI Windows

NextPrevUpTopContentsIndex

7.7 Manipulating top-level windows

7.7.1 Visibility and focus

To bring a top level window to the front (on top of other windows) call raise-interface, and to put it behind other windows call lower-interface.

To hide a window call hide-interface, and to unhide it call show-interface.

To raise an interface and give the input focus to a pane inside it, call activate-pane. For more information about the input focus, see Focus.

You can test whether the interface in which a pane is contained is visible by calling interface-visible-p.

7.7.2 Iconifying and restoring windows

You can iconify an interface window as follows:

(setf (top-level-interface-display-state interface) :iconic)

You can also make it be hidden, maximized or restore it to normal, and you have the option to create it in one of these states initially. For the details see top-level-interface-display-state.

You can test whether an interface is iconified by calling interface-iconified-p.

7.7.3 Closing windows

To close a CAPI interface window unconditionally, call the generic function destroy.

To close a CAPI interface window such that its confirm-destroy-function is called first to allow the user to confirm, call quit-interface. You must call it in the window's process, for example in the callback of a menu item.

7.7.4 Finding interfaces

You can use the function locate-interface to find an interface of a specified class which is currently displayed. It uses the method interface-match-p to decide if there is any "matching" interface, in which case that is simply returned, otherwise it uses interface-reuse-p to decide if any instance of the class can be reused, in which case it reinitializes it using reinitialize-interface and returns it.

find-interface uses locate-interface to find an interface, and if succeeds it activates it, otherwise it creates a new interface. find-interface is used by the LispWorks IDE when starting the tools.

You can call collect-interfaces to obtain a list of displayed interfaces of a specific class.

It is possible to switch off locating of interfaces by calling (setf reuse-interfaces-p). This causes locate-interface to always return nil, and hence find-interface will always create new interface. Note: The IDE uses a different switch for its own interfaces, which can be set from the Preferences... dialog.

7.7.5 Quitting applications

To make an application quit when one of its CAPI windows is closed, make that window's destroy-function call quit.

To arrange for a delivered CAPI application to quit automatically when all of its CAPI windows are closed, call deliver with :quit-when-no-windows t.

7.7.6 Preserving information when saving an IDE session

You can save a session in the LispWorks IDE, either programmatically by hcl:save-current-session or interactively from the Tools menu. If you integrate your own interfaces with the LispWorks IDE and want associated information to be preserved over session saving, you can define interface-preserve-state methods on your own interfaces. You can also use interface-preserving-state-p in the destroy-callback and interface-display methods to check for any destroying/displaying that is performed as part of session saving (as opposed to the normal display/destroy cycle).


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015

NextPrevUpTopContentsIndex