Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab Help >> Graphics > interaction > xclick

xclick

Wait for a mouse click or an event in a graphic window.

Syntax

[ibutton,xcoord,yxcoord,iwin,cbmenu]=xclick([flag])

Arguments

ibutton

Real scalar (integer value): mouse button number, event code... (See description below).

xcoord

Real scalar: x-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).

ycoord

Real scalar: y-coordinate of the mouse pointer when the click or event occurred, in current graphic scale (see gca()).

iwin

Real scalar (integer value): number of the window where the action occurred.

cbmenu

String: callback associated to a menu if xclick returns due to a click on a menu. In this case, ibutton, xcoord, ycoord, and iwin take arbitrary values.

flag

Real scalar (integer value): If present, the click event queue is not cleared when entering xclick.

Description

xclick waits for a mouse click, a keyboard event, a menu activation or windows closure in the graphics window. xclick prevents menu callback to be executed. Callback will be returned in cbmenu return value.

If it is called with 3 left hand side arguments, it waits for a mouse click in the current graphics window.

If it is called with 4 or 5 left hand side arguments, it waits for a mouse click in any graphics window.

Warning, the returned coordinates xcoord, ycoord are relative to the current axes (see gca()).

The values of ibutton are described below.

ibutton==0

Left mouse button has been pressed.

ibutton==1

Middle mouse button has been pressed.

ibutton==2

Right mouse button has been pressed.

ibutton==3

Left mouse button has been clicked.

ibutton==4

Middle mouse button has been clicked.

ibutton==5

Right mouse button has been clicked.

ibutton==10

Left mouse button has been double-clicked.

ibutton==11

Middle mouse button has been double-clicked.

ibutton==12

Right mouse button has been double-clicked.

ibutton >=32

key with ASCII code ibutton has been pressed.

ibutton <= -32

key with ASCII code -ibutton has been released.

ibutton >=1000+32

key with ASCII code ibutton-1000 has been pressed while CTRL key pressed.

ibutton==-1000

graphic window has been closed.

WARNING: ibutton was equal to -100 for graphic window closure up to Scilab 4.1.2, but this code has been changed (in Scilab 5.0) because it was also the code returned for d key release.

ibutton==-2

A dynamic menu has been selected and its callback is returned in cbmenu.

See also

  • gca — Return handle of current axes.
  • locate — mouse selection of a set of points
  • xgetmouse — get the mouse events and current position
  • seteventhandler — set an event handler for the current graphic window
Report an issue
<< twinkle interaction xgetmouse >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:26:51 CET 2018