Banner help needed

I’d like to display an intro screen, where a graphic shows at the top (in a banner window), and scrolling text (reading about, credits, etc.) shows in the main window below it.
My trouble is that I would like the top graphic window to be a fixed size in pixels, but using BannerSizeAbsolute seems to only be absolute as far as text size units. So, if someone changes their interpreter main game font size, my graphic window (but not the actual graphic) expands proportionally, wasting (lots of) reading space in the main window below.
Do I have any options?
Can the interpreter be queried for font size?

I cannot comment on TADS, but an issue is that screens have different sizes of pixels. A desktop typically has 1920 by 1080, but could be significantly more. A tablet will be rather less and a phone smalls still, and likely to be held in portrait mode not landscape.

Likely you have already thought of this, but seems worth mentioning in case not.

1 Like

No, it’s not possible. Best you can do is use the bannerSizeToContents() function to resize the banner to the size of the image. Which in this case should actually be pretty much exactly what you want?

Oh, that sounds like a good option… what Bannerxx constant do I use to show the window with the graphic?
I’ll go play with it and see if I can get it to work out…

BannerTypeText. For example:

picWindow: BannerWindow {
    initBannerWindow()
    {
        showBanner(
            nil, BannerAfter, statuslineBanner, BannerTypeText,
            BannerAlignTop, 0, BannerSizePercent, BannerStyleBorder);
        inherited();
    }
}

If you don’t want a border, use 0 instead of BannerStyleBorder. The size is specified as 0 since you’ll resize it later anyway.

Now you just show an image in the banner and resize it to fit the image:

picWindow.writeToBanner('<center><img src="image.png"></center>');
bannerSizeToContents(picWindow.handle_);

You need to call bannerSizeToContents() every time you change the contents of the banner. Or you can use the CustomBannerWindow class instead (it’s an extension that ships with adv3) and set its autoSize property so it does the resize automatically.

More info: http://tads.org/t3doc/doc/techman/t3banner.htm

1 Like

Awesome Nikos, thanks!