CustomBannerWindow class | customBanner.t[103]

A CustomBannerWindow, like a BannerWindow, corrsponds to an on-screen banner. The purpose of CustomBannerWindow is to eliminate most of the busy-work that a game author would otherwise have to take care of in displaying and manipulating banners.

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`

Superclass Tree (in declaration order)

`CustomBannerWindow`
`BannerWindow`
`OutputStreamWindow`
`object`

Subclass Tree

(none)

Global Objects

(none)

Summary of Properties

`currentContents initBeforeMe inited_`

Inherited from `BannerWindow` :
`align_ handle_ id_ parentID_ size_ sizeUnits_ styleFlags_ windowType_`

Inherited from `OutputStreamWindow` :
`outputStream_`

Summary of Methods

`showCurrentContents`

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`

Properties

`currentContents` | `customBanner.t[367]`

Update our current contents. Note that this takes place even if shouldDisplay is nil, so that if, for example, we are updated on a text-only interpreter on which this banner is not displayed, and the game is saved there and subsequently restored on a full HTML interpreter in which we are displayed, the HTML interpreter will know what contents it needs to display in us.

`initBeforeMe` | `customBanner.t[131]`

If our bannerArgs property contains a list of the right length, i.e. 8 elements, then the first and third elements of the list (our parent, and the sibling we're to be placed before or after) must be initialized before we are. If either of these is nil, no harm is done, since initBannerWindow() will simply skip the nil value.

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]`

If I'm removed I can't be inited_ any more, and I'll need to be regarded as not inited_ in the event of being redisplayed in the future.

Methods

`showCurrentContents (args, ...)` | `customBanner.t[369]`

no description available

Adv3Lite Library Reference Manual
Generated on 08/12/2025 from adv3Lite version 2.2.2