Building a Reusable Dialog Box Component
A reusable component is capable of utilization in multiple places and contexts within a particular code base. Designing a reusable component is different from designing a single-purpose one in several ways. The most relevant one of these ways is that the reusable component’s functionality must be designed to be customizable by users without the basic code needing to be reinvented for it to be worked with.
We examined parts of DialogBox
previously when we looked at how to wrap advancedTexture.getControlByName
in a get or set accessor, so let’s build off that to make an important reminder/note.
Important note
The CONTROL_NAMES
enumeration lists all the properties implemented by the DialogBox
class, but there are more properties than there are controls. Getting or setting a property such as titleText
or bodyText
operates against a text control’s text
property directly.
The key parts of our component are going to...