Optimizing the ImageControls Toolkit Support

Note that the implementation you used for the label identification property in the ImageLabel class is very similar to the implementation of the label identification property in the ImageButton class. Since both of these classes extend the ImageControl class, it might have been preferable to implement support for the label identification property in a support class for the ImageControl (ImageControlCS).

This means that when planning support for the ImageButton and ImageLabel controls, the answer to the second question in the Custom Class Support Planning Checklist would have been Yes (I should first extend support for a control higher in the hierarchy). ImageButtonCS and ImageLabelCS would then extend ImageControlCS, and in ImageLabelCS you would fine-tune the label property by overriding the inherited label_attr method.

In the following sections you modify the ImageControls toolkit support set to prevent the duplicate implementation of the label_attr method. The changes do not affect the functionality of the support. You create the ImageControlCS support class and modify ImageButtonCS and ImageLabelCS to extend ImageControlCS.

For more information, see: