Constant STORY "GQuoteDemo"; Constant HEADLINE "^GWindows Demonstration Program 3: GQuoteWin^"; Constant DEMO 3; Constant PURPOSE "This program shows the use of the GQuoteWin widget. Type 'XYZZY' to bring up a quote."; ! GWindows Demo program. ! ! This demo shows how to use GWindows's quote box widget. ! ! Tell GWindows to use the quote window rather than Glulx's default ! mechanism for the 'box' statement. replace Box__Routine; Constant Quote_GWindow quotewin; ! Include Gwindows Definitions include "gwindefs"; include "parser"; include "verblib"; ! Include GWindows base classes include "gwincls"; ! Include GWindows hooks include "gwindows"; include "grammar"; ! Include GWindows predefined widgets include "gstatus"; include "gquote"; ! InitGWindows. This is where you set up the active interface and the ! main window [ InitGWindows; Active_UI=top; Main_GWindow=mainwin; ]; ! The window model. ! This is similar to GSimple, but we split the main area into ! the main window and the quote window. WindowPair top; WindowPair -> mainarea; Textbuffer -> -> mainwin; ! First window created doesn't need a size GQuoteWin -> -> quotewin; GStatusWin -> statuswin; ! use the default settings for this widget object r1 "Test room" with description "This is a primitive room. Its only purpose is to give the user somewhere to be while viewing this GWindows Demonstration", has light; [ Initialise; location=r1; print "^^^Welcome to GWindows demo program ", DEMO, ". ", (string) PURPOSE, "^^"; ]; ! While the normal 'box' statement will work, ! We have more flexibility if we use quotewin.quote; ! The table we pass in can contain any value that PrintAnything can ! handle object headline_obj "GWindows QuoteWin Demonstration"; Array boxtext table STORY headline_obj "By L. Ross Raszewski" "A demonstration of GWindows"; [xyzzysub; switch(random(3)) { 1: box "Inform is a system for creating adventure" "games, and this is the book to read about" "it." " -- G. Nelson, Inform Designer's Manual"; 2: quotewin.quote(boxtext); ! Normally, quote works out the size of the quote box on its own, but ! we can save it some work by giving it ourselves. ! Here, we do it to artificially enlarge the box 3: quotewin.quote(boxtext,40); } ]; verb 'xyzzy' * -> xyzzy;