previous chapter contents page top page next chapter

Panel

October 5, 1992last updated January 21, 1994

Defined in Panel.Def
 
Inherits from Box

Class Description

The Magic Cap software includes a family of classes whose objects are boxes that are fixed in place, are always at the rear of the view hierarchy, and often contain icons, controls, or other objects for the user to touch. The Panel class provides an abstract base class for these objects. The system includes several subclasses of Panel, including Scene, Bar, and Screen.

Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.

Using a Panel Object

Panel is a subclass of Box that differs very little from its superclass. Panel simply overrides a few methods to implement the basic features of panels: they can't move, can't be brought to the front of the view hierarchy, can't show their labels, and can accept dropped-in objects.

Most objects whose classes are subclasses of Panel are system objects that are always in place, such as the name bar, control bar, and screen. You'll use scenes, another subclass of Panel, in your packages. See the Scene chapter for more information.

Programming Information

Instantiate: never
Subclass: rarely
Call its methods: rarely

Class Panel is abstract; you'll never create or work with any objects of type Panel. You might create your own subclass of Panel if you want to make a class that customizes the basic rules of panels, but it's unlikely you'll have this need.

It's very unlikely that you'll call any methods of class Panel. As mentioned earlier, class Panel defines very few methods, most of which are overrides to implement the basic behavior of panels.

Methods defined by class Panel

The Panel class has no methods that you're likely to call. It overrides four methods inherited from class Box, which are listed here for your convenience:

Method Description
CanAccept Returns true
CanBringToFront Returns false
CanMove Returns false
CanShowLabel Returns false

Fields defined by class Panel

The Panel class defines the following fields:

Field Type Description
Inherited from SingleLinkable:
next Object Next item in view list
Inherited from Linkable:
previous Object Previous item in view list
Inherited from Viewable:
superview Viewable Container for this object
subview Viewable Object contained by this object
relativeOrigin Dot Origin relative to superview
contentSize Dot Size of content rectangle
viewFlags Unsigned Property settings
labelStyle TextStyle Text style of object's label
color Color Color of object's content
shadow Shadow Shadow drawn with object
sound Sound Sound associated with object
Inherited from HasBorder:
border Border Frame drawn around object

Method Descriptions

CanAcceptCoupon

overrides CanAcceptCoupon(coupon: Object; partCode: LongInt): Boolean

Call: rarely
Override: sometimes

(CanAcceptCoupon is implemented in class Box and not overriden by class Panel; it's described here for your convenience in case you override it in a subclass of Panel.)

When the user drags a coupon over the panel, the system calls CanAcceptCoupon to test whether the panel can accept that coupon. Box_CanAcceptCoupon, which is the implementation inherited by Panel, accepts all coupons accepted by its superclass (class Viewable) except sound coupons.

You should override CanAcceptCoupon if you want your subclasses to have different rules about accepting coupons, such as refusing all coupons or only accepting certain types. You should call the inherited CanAcceptCoupon from your overriding method only if you want to use its rules in determining whether to accept the coupon.

See Viewable_CanAcceptCoupon for more information.