Futurebasic/Language/Reference/mouse event

Revised
February, 2002 (Release 6)

Description
If you have designated a mouse-event handling routine using the  statement, then the   functions return information about a mouse click event. Your mouse-event handling routine should check the  function, and possibly the   functions, each time your routine is called.

The  functions will not report a mouse click that occurs inside an active control (such as a button or scrollbar), or in an edit field or picture field, or anywhere outside the active window's content region. Such mouse clicks are handled by other routines, such as your dialog-event handling routine (see the  function), or your menu-event handling routine (see the   function).

MOUSE(0) function The  function indicates whether a single, double or triple-click occurred. It will usually return one of the following values:

Image was here

In rare cases, the user may have time to both click the mouse and release it before your program detects the click. This can happen, for example, if your program runs a long time between successive calls to. In that case,  may return one of the following values:

Image was here

If you just want to detect the click, and you don't care whether the user released the mouse button before your mouse-event handling routine was called, then your routine can just check, which will always return 1, 2 or 3.

MOUSE(locationType) functions To detect where the mouse pointer was at the instant it was clicked, call the  and   functions within your mouse-event handling routine. The values returned by  and   are usually the same as those returned by   and   (see the   functions), but they may be different, especially if the mouse is being moved quickly.

If  returns a positive value (indicating that the mouse was both clicked and released before your mouse-event handling routine was called), then you may also be interested in the values returned by  ÊÊand. These values tell you where the mouse pointer was at the instant the mouse button was released. If  returned a negative value, then   and   are meaningless.

MOUSE Window (Appearance Manager) A new selector helps your program determine where the mouse is located:

...will return the FB window reference number of the window over which the mouse is positioned. The window does not need to be active when this is used.

Click Sequencing FB reports a mouseclick event as soon as it can after the mouse button has been pressed down. If the user executes a double-click, FB interprets it first as a single-click event and then (once the second click happens) as a double-click event. Both "events" will be reported to your mouse-event handling routine. Similarly, if the user executes a triple-click, FB will first report a single-click event, then a double-click event, and finally a triple-click event.

You should take this into account when writing your mouse-event handling routine. The example program "DoubleClick.BAS" handles single-clicks and double-clicks; like most well-designed programs, its interface is designed so that the effects of a single-click are included in the effects of a double-click.

Waiting for the Mouse Up In most cases, FB will call your mouse-event handling routine while the mouse button is still being held down. But in some situations, your routine may need to track the mouse's motion until the button is released. You can use the Toolbox function  to determine when the user releases the mouse button. See the example program, "StillDown.BAS".

Example: Image was here Image was here