CustomBannerWindowclass | customBanner.t[103] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
As with BannerWinnow, merely creating a CustomBannerWindow does not display the banner. However, any CustomBannerWindows in existence at the start of the game will be added to the screen display, unless the condition specified in their shouldDisplay() method prevents initialization.
The one property that must be defined on each instance of a CustomBannerWindow is bannerArgs, which takes the form:
bannerArgs = [parent, where, other, windowType, align, size, sizeUnits, styleFlags]
where each list element has the same meaning at the corresponding argument to BannerWindow.showBanner()
This merely ensures that the CustomBannerWindow is added to the screen's banner window layout. To have the CustomBannerWindow display some content when first added to the screen layout, override its current contents property:
currentContents = 'My initial contents'
To change what's displayed in a CustomBannerWindow from game code, call its updateContents() method, e.g.:
pictureWindow.updateContents('<img src="pics/troll.jpg">');
To redisplay the current contents, call the showCurrentContents() method. By default a call to updateContents() or showCurrentContents() clears the window before displaying the new content. To have the additional content added to the existing content, change the clearBeforeUpdate property to nil.
You can control whether the game uses this banner at all by overriding the canDisplay property. The main purpose of this property is to easily allow a game to run on different types of interpreter. For example, if your banner is meant to display pictures in the JPEG format, there's no point having it included in the screen layout of an interpreter that can't display JPEGs, and attempts to update its contents with a new picture should do nothing. In which case we could define:
canDisplay = (systemInfo(SysInfoJpeg))
Calls to CustomBannerWindow methods like updateContents() and clearWindow() should be safe on an interpreter for which shouldDisplay returns nil, since by default these will do nothing beyond updating the banner's currentContents property. This makes it easier to write game code that is suitable for all classes of interpreter
To have a CustomBannerWindow resize to contents each time its contents are displayed, set its autoSize property to true.
If you do not want a CustomBannerWindow you have defined not to be dispayed at game startup, set its isActive property to nil. Call the activate() method to add it to the screen layout and the deactivate() method to remove it, or any other CustomBannerWindow, from the screen display.
Obviously, it is then the game author's responsibility to ensure that no other banner window that's meant to persist after pictureWindow is deactivated depends on pictureWindow for its existence; i.e. that we're not deactivating the parent of some other banner window(s) we want to keep or subsequently activate, or the sibling of any banner window that's subsequently going to defined in relation to us.
class
CustomBannerWindow : BannerWindow
CustomBannerWindow
BannerWindow
OutputStreamWindow
object
currentContents
initBeforeMe
inited_
Inherited from BannerWindow
:
align_
handle_
id_
parentID_
size_
sizeUnits_
styleFlags_
windowType_
Inherited from OutputStreamWindow
:
outputStream_
Inherited from BannerWindow
:
clearWindow
construct
createOutputStreamObj
createSystemBanner
cursorTo
flushBanner
getBannerID
initBannerWindow
removeBanner
setScreenColor
setSize
setTextColor
showBanner
showForRestore
sizeToContents
updateForRestore
writeToBanner
Inherited from OutputStreamWindow
:
captureOutput
createOutputStream
setOutputStream
currentContents | customBanner.t[367] |
initBeforeMe | customBanner.t[131] |
Moreover, if our sibling is in the list, we don't need our parent as well, since either our sibling or one of its siblings will initialize our parent.
inited_ OVERRIDDEN | customBanner.t[325] |
showCurrentContents (args, ...) | customBanner.t[369] |