Project

General

Profile

Actions

Added in 1.9.4

$click(@window, N)

Retrieves mouse click information from a picture window.

If no properties is defined, returns both X Y.

Parameters

Parameter Description
@window Picture window to use.
N The Nth mouse click item, if N = 0, returns number of mouse click items.

Properties

Property Description
.x Returns the X coordinate of the mouse click.
.y Returns the Y coordinate of the mouse click.

Example

; Create the custom alias to launch the example
;
; Synopsis: /clickWatch

alias clickWatch { 
  ; Create a custom picture window, which is centered.
  window -dpC @clicker 0 0 250 125

  ; Custom 'update' alias keeps code from repeating.
  ; During initial launch the values should be empty.
  update 15 Total Clicks: empty
  update 35 Current Position: none yet
  update 55 Previous Position: none yet
}
; Monitor the sclicks in our custom '@clicker' window.
menu @clicker  {
  sclick: {

    ; Clear the window for the new value updates.
    clear @clicker

    ; Set the %current and %prev variables to the current.
    ; x/y click location, and to the previous x/y click.
    ; locations, respectively.
    var %current = $click(@clicker,0), %prev = $calc(%current - 1)

    ; Utilizing the custom 'update' alias, update the data.
    update 15 Total Clicks: $click(@clicker,0)
    update 35 Current Position: $click(@clicker,%current)
    update 55 Previous Position: $iif(%prev,$click(@clicker,%prev),none yet)
  }
}
; Custom update alias removes a lot of the /drawtext repetition.
; from this example.
alias -l update {
  drawtext @clicker $color(normal) 7 $1 $2-
}

Updated by Per Amundsen over 1 year ago · 3 revisions

Also available in: PDF HTML TXT