matlab CurrentAxes,CurrentCharacter,CurrentPoint


CurrentAxes
    

handle of current axes

Target axes in this figure. MATLAB sets this property to the handle of the figure's current axes (the handle returned by the gca command when this figure is the current figure). In all figures for which axes children exist, there is always a current axes. The current axes does not have to be the topmost axes, and setting an axes to be the CurrentAxes does not restack it above all other axes.

You can make an axes current using the axes and set commands. For example, axes(axes_handle) and set(gcf,'CurrentAxes',axes_handle) both make the axes identified by the handle axes_handle the current axes. In addition, axes(axes_handle) restacks the axes above all other axes in the figure.

If a figure contains no axes, get(gcf,'CurrentAxes') returns the empty matrix. Note that the gca function actually creates an axes if one does not exist.


CurrentCharacter
    

single character

Last key pressed. MATLAB sets this property to the last key pressed in the figure window. Use CurrentCharacter to obtain user input.
CurrentObject
    

object handle

Handle of current object. MATLAB sets this property to the handle of the last object clicked on by the mouse. This object is the frontmost object in the view. You can use this property to determine which object a user has selected. The function gco provides a convenient way to retrieve the CurrentObject of the CurrentFigure.

Note that the HitTest property controls whether an object can become the CurrentObject.

Hidden Handle Objects

Clicking an object whose HandleVisibility property is off (such as axis labels and title) causes the CurrentObject property to be set to empty []. To avoid returning an empty value when users click hidden objects, set the hidden object's HitTest property to off.

Mouse Over

Note that cursor motion over objects does not update the CurrentObject; you must click objects to update this property. See the CurrentPoint property for related information.


CurrentPoint
    

two-element vector: [x-coordinate, y-coordinate]

Location of last button click in this figure. MATLAB sets this property to the location of the pointer at the time of the most recent mouse button press. MATLAB updates this property whenever you press the mouse button while the pointer is in the figure window.

Note that if you select a point in the figure and then use the values returned by the CurrentPoint property to plot that point, there can be differences in the position due to round-off errors.

CurrentPoint and Cursor Motion

In addition to the behavior described above, MATLAB updates CurrentPoint before executing callback routines defined for the figure WindowButtonMotionFcn and WindowButtonUpFcn properties. This enables you to query CurrentPoint from these callback routines. It behaves like this:

If there is no callback routine defined for the WindowButtonMotionFcn or the WindowButtonUpFcn, then MATLAB updates the CurrentPoint only when the mouse button is pressed down within the figure window.

If there is a callback routine defined for the WindowButtonMotionFcn, then MATLAB updates the CurrentPoint just before executing the callback. Note that the WindowButtonMotionFcn executes only within the figure window unless the mouse button is pressed down within the window and then held down while the pointer is moved around the screen. In this case, the routine executes (and the CurrentPoint is updated) anywhere on the screen until the mouse button is released.

If there is a callback routine defined for the WindowButtonUpFcn, MATLAB updates the CurrentPoint just before executing the callback. Note that the WindowButtonUpFcn executes only while the pointer is within the figure window unless the mouse button is pressed down initially within the window. In this case, releasing the button anywhere on the screen triggers callback execution, which is preceded by an update of the CurrentPoint.

The figure CurrentPoint is updated only when certain events occur, as previously described. In some situations (such as when the WindowButtonMotionFcn takes a long time to execute and the pointer is moved very rapidly), the CurrentPoint might not reflect the actual location of the pointer, but rather the location at the time when the WindowButtonMotionFcn began execution.

The CurrentPoint is measured from the lower-left corner of the figure window, in units determined by the Units property.

The root PointerLocation property contains the location of the pointer updated synchronously with pointer movement. However, the location is measured with respect to the screen, not a figure window.

See uicontrol for information on how this property is set when you click a uicontrol object.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值