Generic FunctionPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


Arguments: window-or-widget-or-nil &key (position (and window-or-widget-or-nil :center)) (mouse-button :left) (pre-expose t) (preview-seconds 0.5) (down-seconds 0.5)

This generic function programmatically emulates clicking a mouse button, after optionally exposing a window and/or moving the mouse cursor over it. This may be useful for automated testing.

window-or-widget-or-nil may be either a window, a dialog-item, or nil. If this argument is non-nil and pre-expose is true, then the specified window or widget and all of its ancestor windows are selected so that the window or widget is in front to receive the mouse click. The position argument will also be relative to this window or widget.

The keyword arguments are:


;; Left-click at the center of a window's scrollable page.
(do-click some-window)

;; Left-click near the upper-right corner of its scrollable page.
(do-click some-window
  :position (make-position (- (interior-width some-window) 8)

;; Left-click it with no pause for people to watch the action.
(do-click some-window :preview-seconds nil :down-seconds nil)

;; Right-click in the center of a window's scrollable page.
(do-click some-window :button :right)

;; Left-click whatever is under the mouse.
(do-click nil)

;; Left-click an arbitary position on the screen.
(do-click nil :position (make-position 100 200))

;; Left-click over the center of a window, but without
;; first exposing it.  So if another window covers it, then the
;; click will go to that window instead.  Pre-expose defaults to
;; t to ensure that the click goes to the specified window, but
;; it may be useful to pass it as nil as in this example if you
;; are testing that the window is exposed when it should be.
(do-click some-window :pre-expose nil)

GTK Note

This function is not implemented on GTK, and we doubt that there is any feasible way to implement it. The function does not exist at all on the GTK platform, so you should use #+mswindows to conditionalize any calls to it.

Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
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