3  MysterX browsers

A MysterX program consists of one or browsers. From a visual standpoint, a browser appears as a window on the computer screen. From a Scheme standpoint, a browser is an instance of the class mx-browser%. Like any other Scheme class, you use make-object to create an instance of mx-document%. The syntax is

(make-object mx-browser% label width height x y style-list)

All the arguments except mx-document% are optional. If an optional argument is omitted, a default value is used. The label argument is a string for the caption in the window titlebar, and defaults to ``MysterX''. The width, height, x, and y argments are integers describing the window size and placement; if omitted, the operating system supplies defaults; the symbol 'default may also be used explicitly. The style-list is a Scheme list of style options for the window, and may contain any of the symbols 'iconize, 'maximize, 'no-system-menu, 'no-thick-border, and scrollbars. Here's an example:

(define browser (make-object mx-browser% "A MysterX browser" 300 400))

We'll use this browser in our examples below.

The class mx-browser% contains a number of public methods. You can hide and show the document window with the show method. For example

(send browser show #f)

hides the window for browser. An argument other than #f shows the window.

Like other browsers, a MysterX browser can be used to surf the World-Wide Web. If your computer is connected to the Internet, evaluating the expression

(send browser navigate "http://www.cs.rice.edu/CS/PLT/")

causes the browser to navigate to the PLT home page. The methods go-back and go-forward allow the browser to revisit previously-viewed Web pages.