Skip to content

CreateCursor

  scCreateCursor creates or replaces a vertical cursor

  Examples
  n=CreateCursor()
  n=CreateCursor(fighandle)
  n=CreateCursor(fighandle, CursorNumber)
  n=CreateCursor(fighandle, CursorNumber, AxesList)
  n=CreateCursor(fighandle, CursorNumber, AxesList, UserFunction)

  Cursors are specific to a figure. If the figure handle is not specified
  in fhandle, the current figure (returned by gcf) will be used.
  CursorNumber is any positive number. If not specified the lowest numbered
  free cursor number will be used. 

  AxesList, if supplied and not empty, is vector of axes handles and 
  will restrict the drawing of cursors to the specified axes. Note that
  cursor numbers must be unique to any MATLAB figure but using this feature,
  cursors 1 and 2, for example,  could be applied to one set of axes 
  while 3 and 4 are applied to a second set.

  UserFunction, if specified is a function handle or a cell array
  containing a function handle in the first element. The function will be
  called when there is a ButtonUpEvent following movement of the cursor.
  if UserFunction is a cell array, the 2nd and subsequent elements will be
  passed to the function as arguments.

  Returns n, the number of the cursor created in the relevant figure.

  A record is kept of the cursors in the figure's application data
  area. Cursor n occupies the nth element of a cell array. Each element is
  a structure containing the following fields:
            Handles:    a list of objects associated with this cursor -
                        one line for each axes and one or more text objects
            IsActive:   true if this cursor is currently being moved. False
                        otherwise. For manual cursors, IsActive is set by a
                        button down on the cursor and cleared by a button
                        up. 
  Functions that affect the position of a cursor must explicitly update all
  the objects listed in Handles. A cursor is not presently an object itself.

  Revisions: 27.02.07 add restoration of gca
             30.01.08 add uicontextmenu. Speed up UpdateCursorPosition.
             14.11.09 add UserFunction argument
             15.11.09 update text label only on button up - improves speed

  -------------------------------------------------------------------------
  Author: Malcolm Lidierth 01/07
  Copyright © The Author & King's College London 2007-
  -------------------------------------------------------------------------