BB___MouseX

=MouseX= toc

Description
> This special variable, along with MouseY, holds the X, Y coords of the mouse position within the client area of a graphic window or graphicbox. The mouse position can only be captured when a graphic window or graphicbox has the input focus. Normally, the mouse position is used when a mouse **event** occurs. See when mouseEvent

Syntax

 * 1)  - (case sensitive)

Hints
>> code format="lb" code
 * //**Setting Focus.**// To be certain your graphic window or graphicbox has the focus, issue a **"setfocus"** command to the window.
 * //**Trapping Mouse Position.**// When a mouse event is trapped, the position of the mouse in X and Y pixel coords from the upper left corner of the window or control is placed in the variables MouseX and MouseY. An example:
 * 1) handle.ext "setfocus; when mouseMove eventHandler"

Example
An example to retrieve and use mouse coordinates, using both a branch label and a sub for event handlers. code format="lb" open "Plot something!" for graphics as #w print #w, "when leftButtonMove [paint]" print #w, "when leftButtonUp coords" print #w, "down ; size 3" wait [paint] print #w, "set "; MouseX; " "; MouseY wait

sub coords handle$, x, y   #handle$ "\"; x; " "; y end sub code

Useful Functions
code format="lb" Place a useful function using this command here code