MATLAB Function Reference Previous page   Next Page
Light Properties

Modifying Properties

You can set and query graphics object properties in two ways:

To change the default values of properties, see Setting Default Property Values.

See Core Objects for general information about this type of object.

Light Property Descriptions

This section lists property names along with the type of values each accepts.

BeingDeleted                 on | {off} Read Only

This object is being deleted. The BeingDeleted property provides a mechanism that you can use to determine if objects are in the process of being deleted. MATLAB sets the BeingDeleted property to on when the object's delete function callback is called (see the DeleteFcn property). It remains set to on while the delete function executes, after which the object no longer exists.

For example, an object's delete function might call other functions that act on a number of different objects. These functions may not need to perform actions on objects that are going to be deleted and, therefore, can check the object's BeingDeleted property before acting.

BusyAction                   cancel | {queue}

Callback routine interruption. The BusyAction property enables you to control how MATLAB handles events that potentially interrupt executing callback routines. If there is a callback routine executing, callback routines invoked subsequently always attempt to interrupt it. If the Interruptible property of the object whose callback is executing is set to on (the default), then interruption occurs at the next point where the event queue is processed. If the Interruptible property is off, the BusyAction property (of the object owning the executing callback) determines how MATLAB handles the event. The choices are

ButtonDownFcn                string

This property is not useful on lights.

Children                     handles

The empty matrix; light objects have no children.

Clipping                     on | off

Clipping has no effect on light objects.

Color                        ColorSpec

Color of light. This property defines the color of the light emanating from the light object. Define it as a three-element RGB vector or one of the MATLAB predefined names. See the ColorSpec reference page for more information.

CreateFcn                    string or function handle

Callback routine executed during object creation. This property defines a callback routine that executes when MATLAB creates a light object. You must define this property as a default value for lights or in a call to the light function to create a new light object. For example, the statement

sets the current figure colormap to hsv whenever you create a light object. MATLAB executes this routine after setting all light properties. Setting this property on an existing light object has no effect.

The handle of the object whose CreateFcn is being executed is accessible only through the root CallbackObject property, which you can query using gcbo.

See Function Handle Callbacks for information on how to use function handles to define the callback function.

DeleteFcn                    string or function handle

Delete light callback routine. A callback routine that executes when you delete the light object (i.e., when you issue a delete command or clear the axes or figure containing the light). MATLAB executes the routine before destroying the object's properties so these values are available to the callback routine.

The handle of the object whose DeleteFcn is being executed is accessible only through the root CallbackObject property, which you can query using gcbo.

See Function Handle Callbacks for information on how to use function handles to define the callback function.

HandleVisibility             {on} | callback | off

Control access to object's handle by command-line users and GUIs. This property determines when an object's handle is visible in its parent's list of children. HandleVisibility is useful for preventing command-line users from accidentally drawing into or deleting a figure that contains only user interface devices (such as a dialog box).

Handles are always visible when HandleVisibility is on.

Setting HandleVisibility to callback causes handles to be visible from within callback routines or functions invoked by callback routines, but not from within functions invoked from the command line. This provides a means to protect GUIs from command-line users, while allowing callback routines to have complete access to object handles.

Setting HandleVisibility to off makes handles invisible at all times. This may be necessary when a callback routine invokes a function that might potentially damage the GUI (such as evaluating a user-typed string), and so temporarily hides its own handles during the execution of that function.

When a handle is not visible in its parent's list of children, it cannot be returned by functions that obtain handles by searching the object hierarchy or querying handle properties. This includes get, findobj, gca, gcf, gco, newplot, cla, clf, and close.

When a handle's visibility is restricted using callback or off, the object's handle does not appear in its parent's Children property, figures do not appear in the root's CurrentFigure property, objects do not appear in the root's CallbackObject property or in the figure's CurrentObject property, and axes do not appear in their parent's CurrentAxes property.

You can set the root ShowHiddenHandles property to on to make all handles visible regardless of their HandleVisibility settings (this does not affect the values of the HandleVisibility properties).

Handles that are hidden are still valid. If you know an object's handle, you can set and get its properties, and pass it to any function that operates on handles.

HitTest                      {on} | off

This property is not used by light objects.

Interruptible                {on} | off

Callback routine interruption mode. Light object callback routines defined for the DeleteFcn property are not affected by the Interruptible property.

Parent                       handle of parent axes, hggroup,or hgtransform

Parent of light object. This property contains the handle of the light object's parent. The parent of a light object is the axes, hggroup, or hgtransform object that contains it.

See Objects That Can Contain Other Objects for more information on parenting graphics objects.

Position                     [x,y,z] in axes data units

Location of light object. This property specifies a vector defining the location of the light object. The vector is defined from the origin to the specified x-, y-, and z-coordinates. The placement of the light depends on the setting of the Style property:

Selected                     on | off

This property is not used by light objects.

SelectionHighlight           {on} | off

This property is not used by light objects.

Style                        {infinite} | local

Parallel or divergent light source. This property determines whether MATLAB places the light object at infinity, in which case the light rays are parallel, or at the location specified by the Position property, in which case the light rays diverge in all directions. See the Position property.

Tag                          string

User-specified object label. The Tag property provides a means to identify graphics objects with a user-specified label. This is particularly useful when you are constructing interactive graphics programs that would otherwise need to define object handles as global variables or pass them as arguments between callback routines. You can define Tag as any string.

Type                         string (read only)

Type of graphics object. This property contains a string that identifies the class of graphics object. For light objects, Type is always 'light'.

UIContextMenu                handle of a uicontextmenu object

This property is not used by light objects.

UserData                     matrix

User-specified data. This property can be any data you want to associate with the light object. The light does not use this property, but you can access it using set and get.

Visible                      {on} | off

Light visibility. While light objects themselves are not visible, you can see the light on patch and surface objects. When you set Visible to off, the light emanating from the source is not visible. There must be at least one light object in the axes whose Visible property is on for any lighting features to be enabled (including the axes AmbientLightColor and patch and surface AmbientStrength).


Previous page  light lightangle Next page

© 1994-2005 The MathWorks, Inc.