Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version

find-links

Arguments: rich-edit-pane &key (link-color (link-color rich-edit-pane)) append

Finds all of the substrings of a certain color on rich-edit-pane (which must be an instance of the rich-edit-pane class) and returns a list indicating the starting and ending indices of each string. Each member of the returned list represents one link as a list of its starting index, its ending index, the string itself, and the link color. The list of links is in the order that the links appear in the rich-edit-pane.

link-color should be an rgb color object, and defaults to the link-color of the window, which defaults to blue.

If the append keyword argument is nil (the default), then any previously-found links for this rich-edit-pane will be discarded, leaving only the links found by this call as the links of the window. If append is true, then the links found by this call will be appended to the window's current links. This allows setting up links in multiple colors by calling find-links a number of times with different colors, passing append as true on all but the first call. The function links could be called at any later time to retrieve the combined list of links.

For example, find-links might return the following list when passed a rich-edit-pane with three blue strings in it:

((10 16 "mumble")(36 39 "foo")(120 134 "how about that"))

find-links caches the returned list as the links property of the rich-edit-pane, so that it may be referenced later without re-searching for the links.

Finding links is a relatively slow procedure, and may not be fast enough to do on the fly as the end user open rich text files or clicks on links. Therefore it is recommended that find-links be called when a file is saved, and the list of returned links saved somewhere so that when the file is reloaded, the list of links can be retrieved and re-associated with the rich-edit-pane.

rich-edit-save and rich-edit-save-as will call find-links automatically if the save-links property of the rich-edit control or rich-edit-pane window has been turned on (it is off by default). After it finds the links, it saves them in a file with the same path as the rich text except with a .lin extension. This file is then read back by rich-edit-open if save-links is turned on so that the links may be used without re-searching for them when the file is opened.

See cg-rich-text.htm for information about rich text editing in Common Graphics.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version