ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


The class of a hotspot object. Hotspots are invisible regions on a window that can receive and respond to mouse events just as actual windows do. They can be used to overlay images drawn on a window in order to make the images behave as graphical objects without using a separate child window that would obscure overlapping images on the main window.

The mouse-in, mouse-out, and various mouse click methods such as mouse-left-down are invoked for hotspot instances just as it is for windows. If you define mouse click methods for hotspots, the methods should return nil if you want the click to be further processed by the hotspot's parent window, or non-nil to prevent further processing of the click by the window.

General steps for using hotspots

A hotspot's highlight-style may optionally be set to :invert or :outline to make the hotspot highlight itself whenever the mouse is inside its hotspot-region. If these two built-in highlight styles are not adequate, you can override the default highlight-hotspot method to highlight the hotspot however you like.

Other than highlighting themselves when under the mouse cursor, hotspots do not draw anything on their parent window. Typically a hotspot covers the same region where something is drawn, allowing the user to click on that thing. But since an application could draw any sort of graphic where the hotspot lies, the hotspot does not attempt to do this drawing itself; instead, the window's redisplay-window method should draw the "real" object that the hotspot is making active. For a polygon hotspot, for example, the redisplay-window method could pass the same vector of positions to draw-polygon to draw the "real" polygon as the corresponding hotspot uses to define its hotspot-region.

Here are some other properties that hotspots can be given, either by passing the keyword initarg such as :name to make-instance, or by calling the setf function such as (setf name) any time later.

The function hotspots returns a list of all of the hotspots that are currently on a window, and current-hotspot returns the one that is currently under the mouse, if any. Calling parent on a hotspot returns the window that it is on, if any.

The IDE's Navigator Dialog includes a complete example of using hotspots. Look for Hotspots: mouse-active highlighting regions.

This page was not revised from the 10.0 page.
Created 2017.2.15.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version