home contact subscribe toolbook.org

Edgelock System Book

The Edgelock system book (edgelock.sbk) provides a generic mechanism for adding distortionless page resizing behaviour to ToolBook books.

One of the perennial problems faced by ToolBook developers is how to enable applications to scale their page size and layout to match the display resolution of the end user’s machine. The usual, but often unsatisfactory, solution is to fix the size of the ToolBook window so that it remains a static size irrespective of display resolution. When all resolutions must be supported this means adopting the lowest common denominator ToolBook page size of 640×480 pixels. This is as much as a basic VGA screen can display but appears as only a small window on an increasingly popular 1024×768 display.

Applications such as Microsoft Encarta exhibit a far more complex solution to this problem which involves stretching some elements of the display while keeping others constant or "locked" at a fixed distance from one of more edges of the window. This allows the application to use the full screen regardless of resolution and pick sensible resizing/repositioning behaviours to avoid image distortion.

This effect can be reproduced in ToolBook: it is possible to resize both the ToolBook page and all the objects on a page at runtime using OpenScript code. This, in theory, allows a ToolBook book or viewer to rescale its page and objects to any size. Unfortunately, this almost always produces unacceptable distortion of bitmaps, graphics, text and the spacing between objects (this is the effect which distorts the objects of a ToolBook group when you resize it). To overcome this problem it would usually be necessary to program constrained resizing behaviours for each object or each layout using OpenScript. Such an approach is time consuming, error prone and expensive. The edgelock.sbk system book offers a simpler way of implementing complex resizing behaviour without having to write, test and debug new OpenScript code for each page or layout. The same system book can also be used to create complex resizing behaviour in viewers other than the main ToolBook window and it can even be applied to groups or widgets.

To use the Edgelock system book, download the following zip file and work through the pages of the resize2.tbk book to learn what edgelock does and how it works. The resize2.tbk book is an updated version of the resize.tbk book presented at Online Learning Euro 97 and differs only in that the edgelock script has now been moved to a system book rather than residing in the book script. Since 97 the edgelock script itself has been enhanced to cope with resizing groups or widgets as well as viewers. A demonstration of this new feature is included in the lockdemo.tbk file along with some brief instructions.

edgelock.zip (127K)