Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version

selected-object

Arguments: window

Returns an object or a list of objects that are considered to be selected in window and which may be acted upon by arbitrary (typically menu) commands. In the development environment, menu commands typically act upon the selected-object of the window that currently has the keyboard focus. Methods can be added on this generic function to return appropriate objects for specialized classes of windows, though the default behavior will often suffice. If no object is selected, this function returns nil.

If text is selected, that text is returned as a string. If other objects are selected (controls on a form, for example), a list of selected objects is returned.

Note: this function will return true both when an object is selected and highlighted (e.g. text which is highlighted after the left mouse button is depressed and dragged over the text) and when the cursor is within text but no text is highlighted. Thus, if the cursor is between the f and the first o of foo, foo will be returned by selected-object even though no text is highlighted. While some menu commands work on objects selected by the second definition (cursor in the text but no text highlighted), others, Cut for example, do not work in that case. The function get-selection returns two integers indicating the beginning and the end of highlighted text. If the two values returned by that function are equal, no text is highlighted and commands that only work on highlighted text should not be invoked.

Programmers may wish to make menu-items that only work on highlighted text unavailable if no text is highlighted when the menu is shown. The generic function about-to-show-menu is called just prior to a menu being displayed and is designed to allow menu-items to be made available or unavailable based on the current state. Programmers can subclass menu and write methods on about-to-show-menu to achieve the desired behavior, such as making Copy unavailable if selected-object returns nil and Cut unavailable when selected-object returns true but get-selection indicates there is no highlighted text.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version