3.1 Browsers
superclass: object% |
[
[label label]
[width width]
[height height]
[x x]
[y y]]
[style style])
→
label : string? = "MysterX"
width
:
(or/c exact-nonnegative-integer? (one-of/c 'default))
=
'default
height
:
(or/c exact-nonnegative-integer? (one-of/c 'default))
=
'default
x : (or/c exact-integer? (one-of/c 'default)) = 'default
y : (or/c exact-integer? (one-of/c 'default)) = 'default
style
:
(listof (any-of/c 'iconize 'maximize 'no-system-menu
'no-thick-border 'scrollbars))
Creates an instance of a MysterX browser. The label argument is a string for the document caption, with default . The width, height, x, and y give the size and placement of the browser window on the desktop, with defaults provided by Windows. When style-list includes 'scrollbars, the vertical scrollbar is disabled if scrolling is unnecessary, and the horizontal scrollbar disappears if scrolling is unnecessary.
Although the browser window cannot be hidden initially, it can be iconized. The restore method can be used to restore an iconized browser to an ordinary window.
(send a-mx-browser current-document)
Returns the current document in the browser.
(send a-mx-browser print-document) → void?
Prints the document displayed by the browser to the default printer. As an unintentional side-effect, the browser window is minimized.
show? : any/c
If show? is #f, the browser window is hidden. Otherwise, the window is shown.
url : string?
Navigates the browser to the URL given by url. Any DHTML changes to the page associated with the URL are not shown. Returns a string that is the actual URL navigated to.
(send a-mx-browser navigate/status url)
→ (list/c string? (or/c false/c integer? (one-of/c 'no-status)))
url : string?
Navigates the browser to the URL given by url. Any DHTML changes to the page associated with the URL are not shown. Returns a list, whose first element string that is the actual URL navigated to, and whose second element is a status code, one of: #f, indicating no status could be obtained; a number, such as 200 or 404, indicating the http status; or 'no-status, indicating that url does not denote a URL with the “http” scheme.
Navigates the browser back to a URL within its history list. Any DHTML changes to the page associated with the URL are not shown. Returns a string that is the actual URL navigated to.
(send a-mx-browser go-forward) → string?
Navigates the browser forward to a URL within its history list. Any DHTML changes to the page associated with the URL are not shown. Returns a string that is the actual URL navigated to.
Refreshes the document in the browser. Returns #t if the refresh is successful, #f otherwise.
Iconizes the browser window.
Restores the browser window, if it has been iconized.
(send a-mx-browser current-url) → string?
Returns a string indicating the currently displayed URL.
(send a-mx-browser register-event-handler
elem
f)
→
elem : (is-a?/c mx-element%)
f : ((is-a?/c mx-event<%>) . -> . any)
Registers an event handler for the HTML element elem. The result of f is discarded.
(send a-mx-browser unregister-event-handler elem) → void?
elem : (is-a?/c mx-element%)
Unregisters an event handler for an HTML element in the browser.
(send a-mx-browser handle-events) → void?
Creates a thread to handle events using the registered event handlers.
(send a-mx-browser stop-handling-events) → void?
Kills the thread currently handling events for the browser.
Blocks until all browser windows have been closed or hidden, using the show method of mx-browser%. This is useful when a MysterX program file is run as a script, to prevent mzscheme or mred from closing prematurely.