finish mysterx docs
svn: r9329
This commit is contained in:
parent
92bd8e3929
commit
3bb0a78d0d
|
@ -27,7 +27,6 @@
|
||||||
mx-document<%>
|
mx-document<%>
|
||||||
mx-event<%>
|
mx-event<%>
|
||||||
mx-version
|
mx-version
|
||||||
mx-any?
|
|
||||||
block-while-browsers
|
block-while-browsers
|
||||||
com-invoke
|
com-invoke
|
||||||
com-get-property
|
com-get-property
|
||||||
|
@ -2597,17 +2596,6 @@
|
||||||
|
|
||||||
(define mx-document<%> (class->interface mx-document%))
|
(define mx-document<%> (class->interface mx-document%))
|
||||||
|
|
||||||
(define (mx-any? v)
|
|
||||||
(or (char? v)
|
|
||||||
(real? v)
|
|
||||||
(string? v)
|
|
||||||
(boolean? v)
|
|
||||||
(com-date? v)
|
|
||||||
(com-currency? v)
|
|
||||||
(com-scode? v)
|
|
||||||
(com-iunknown? v)
|
|
||||||
(com-object? v)))
|
|
||||||
|
|
||||||
(thread
|
(thread
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
|
|
14
collects/mysterx/scribblings/activex.scrbl
Normal file
14
collects/mysterx/scribblings/activex.scrbl
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#lang scribble/doc
|
||||||
|
@(require "common.ss")
|
||||||
|
|
||||||
|
@title[#:tag "activex" #:style 'toc]{ActiveX and DHTML}
|
||||||
|
|
||||||
|
A MysterX application consists of one or more browsers, which are
|
||||||
|
instances of the class @scheme[mx-browser%].
|
||||||
|
|
||||||
|
@local-table-of-contents[]
|
||||||
|
|
||||||
|
@include-section["browsers.scrbl"]
|
||||||
|
@include-section["documents.scrbl"]
|
||||||
|
@include-section["html-events.scrbl"]
|
||||||
|
@include-section["html.scrbl"]
|
|
@ -3,16 +3,6 @@
|
||||||
|
|
||||||
@title[#:tag "browsers"]{Browsers}
|
@title[#:tag "browsers"]{Browsers}
|
||||||
|
|
||||||
A MysterX application consists of one or more browsers, which are
|
|
||||||
instances of the class @scheme[mx-browser%].
|
|
||||||
|
|
||||||
@defproc[(block-while-browsers) void?]{
|
|
||||||
|
|
||||||
Blocks until all browser windows have been closed or hidden, using
|
|
||||||
the show method of @scheme[mx-browser%]. This is useful when a
|
|
||||||
MysterX program file is run as a script, to prevent @exec{mzscheme}
|
|
||||||
or @exec{mred} from closing prematurely.}
|
|
||||||
|
|
||||||
@defclass[mx-browser% object% ()]{
|
@defclass[mx-browser% object% ()]{
|
||||||
|
|
||||||
@defconstructor[([label string? "MysterX"]
|
@defconstructor[([label string? "MysterX"]
|
||||||
|
@ -124,3 +114,14 @@
|
||||||
the browser.}
|
the browser.}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@; ----------------------------------------
|
||||||
|
|
||||||
|
@defproc[(block-while-browsers) void?]{
|
||||||
|
|
||||||
|
Blocks until all browser windows have been closed or hidden, using
|
||||||
|
the show method of @scheme[mx-browser%]. This is useful when a
|
||||||
|
MysterX program file is run as a script, to prevent @exec{mzscheme}
|
||||||
|
or @exec{mred} from closing prematurely.}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
@title[#:tag "com-types"]{COM Types}
|
@title[#:tag "com-types"]{COM Types}
|
||||||
|
|
||||||
|
In the result of a function like @scheme[com-method-type], a type
|
||||||
|
@indexed-scheme['mx-any] standards for a character, real number,
|
||||||
|
string, boolean, COM currency (as in @scheme[com-currency?]), COM date
|
||||||
|
(as in @scheme[com-date?]), COM scode value (as in
|
||||||
|
@scheme[com-scode?]), COM IUnknown value (as in
|
||||||
|
@scheme[com-iunknown?], or COM object (as in @scheme[com-object?]).}
|
||||||
|
|
||||||
@defproc[(com-object-type [obj com-object?]) com-type?]{
|
@defproc[(com-object-type [obj com-object?]) com-type?]{
|
||||||
|
|
||||||
Returns a type for a COM object.}
|
Returns a type for a COM object.}
|
||||||
|
@ -12,3 +19,58 @@
|
||||||
Return @scheme[#t] if @scheme[obj] is of the
|
Return @scheme[#t] if @scheme[obj] is of the
|
||||||
type @scheme[type].}
|
type @scheme[type].}
|
||||||
|
|
||||||
|
@defproc[(com-currency? [v any/c]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if @scheme[v] is a COM currency value,
|
||||||
|
@scheme[#f] otherwise.}
|
||||||
|
|
||||||
|
@defproc[(com-currency->number [curr com-currency?]) real?]{
|
||||||
|
|
||||||
|
Returns a number for @scheme[curr].}
|
||||||
|
|
||||||
|
@defproc[(number->com-currency [n real?]) com-currency?]{
|
||||||
|
|
||||||
|
Converts a number to a COM currency value. A currency value is
|
||||||
|
repsented with a 64-bit two's-complement integer, though @scheme[n]
|
||||||
|
may contain decimal digits. If @scheme[n] is too large, an
|
||||||
|
exception is raised.}
|
||||||
|
|
||||||
|
@defproc[(com-date? [v any/c]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if @scheme[v] is a COM date value, @scheme[#f]
|
||||||
|
otherwise.}
|
||||||
|
|
||||||
|
@defproc[(com-date->date [d com-date?]) date?]{
|
||||||
|
|
||||||
|
Converts a COM date to an instance of the @scheme[date] structure
|
||||||
|
type. In the result, the @scheme[dst?] field is always @scheme[#f],
|
||||||
|
and the @scheme[time-zone-offset] field is @scheme[0].}
|
||||||
|
|
||||||
|
@defproc[(date->com-date [d date?]) com-date?]{
|
||||||
|
|
||||||
|
Converts a @scheme[date] instance to a COM date value.}
|
||||||
|
|
||||||
|
@defproc[(com-scode? [v any/c]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if @scheme[v] is a COM scode value, @scheme[#f]
|
||||||
|
otherwise.}
|
||||||
|
|
||||||
|
@defproc[(com-scode->number [sc com-scode?]) integer?]{
|
||||||
|
|
||||||
|
Converts a COM scode value to an integer.}
|
||||||
|
|
||||||
|
@defproc[(number->com-scode [n integer?]) com-scode?]{
|
||||||
|
|
||||||
|
Converts a number to a COM scode value. The number must be
|
||||||
|
representable as a 32-bit two's-complement number, otherwise an
|
||||||
|
exception is raised.}
|
||||||
|
|
||||||
|
@defproc[(com-iunknown? [v any/c]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if @scheme[v] is a COM IUnknown value,
|
||||||
|
@scheme[#f] otherwise.}
|
||||||
|
|
||||||
|
@defthing[com-omit any/c]{
|
||||||
|
|
||||||
|
Used with @scheme[com-invoke] to represent an argument that is not
|
||||||
|
provided.}
|
||||||
|
|
|
@ -1,164 +1,15 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "common.ss")
|
@(require "common.ss")
|
||||||
|
|
||||||
@title[#:tag "com"]{COM Methods and Properties}
|
@title[#:tag "com" #:style 'toc]{COM}
|
||||||
|
|
||||||
MysterX allows scripting of most COM components from Scheme. A COM
|
MysterX allows scripting of most COM components from Scheme. A COM
|
||||||
component can be scripted in MysterX if it supports OLE Automation
|
component can be scripted in MysterX if it supports OLE Automation via
|
||||||
via the @tt{IDispatch} interface, and if it publishes type
|
the @tt{IDispatch} interface, and if it publishes type information
|
||||||
information using the @tt{ITypeInfo} interface.
|
using the @tt{ITypeInfo} interface.
|
||||||
|
|
||||||
@defproc[(com-all-coclasses) (listof string?)]{
|
@local-table-of-contents[]
|
||||||
|
|
||||||
Returns a list of strings for all COM classes
|
@include-section["methprop.scrbl"]
|
||||||
registered on a system.}
|
@include-section["com-types.scrbl"]
|
||||||
|
@include-section["com-events.scrbl"]
|
||||||
@defproc[(com-all-controls) (listof string?)]{
|
|
||||||
|
|
||||||
Returns a list of strings for all COM classes
|
|
||||||
registered on a system that have the @scheme["Control"]
|
|
||||||
subkey.}
|
|
||||||
|
|
||||||
@deftogether[(
|
|
||||||
@defproc[(cocreate-instance-from-coclass [coclass string?]
|
|
||||||
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
|
||||||
com-object?]
|
|
||||||
@defproc[(cci/coclass [coclass string?]
|
|
||||||
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
|
||||||
com-object?]
|
|
||||||
)]{
|
|
||||||
|
|
||||||
Returns an instance of @scheme[coclass]. This is useful for COM
|
|
||||||
classes without a visual representation, or when a visual
|
|
||||||
representation is not needed.
|
|
||||||
|
|
||||||
The optional argument @scheme[where] indicates a for running the
|
|
||||||
instance, and may be @scheme['local], @scheme['remote], or a string
|
|
||||||
indicating a machine name. See @secref["remote"] for more
|
|
||||||
information.}
|
|
||||||
|
|
||||||
@deftogether[(
|
|
||||||
@defproc[(cocreate-instance-from-progid [progid string?]
|
|
||||||
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
|
||||||
com-object?]
|
|
||||||
@defproc[(cci/progid [progid string?]
|
|
||||||
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
|
||||||
com-object?]
|
|
||||||
)]{
|
|
||||||
|
|
||||||
Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
|
|
||||||
|
|
||||||
|
|
||||||
@defproc[(coclass [obj com-object?]) string?]{
|
|
||||||
|
|
||||||
Returns a string that is the name of the COM class instantiated by
|
|
||||||
@scheme[obj], or raises an error if the COM class is not known.}
|
|
||||||
|
|
||||||
@defproc[(progid [obj com-object?]) string?]{
|
|
||||||
|
|
||||||
Returns a string that is the name of the ProgID instantiated by
|
|
||||||
@scheme[obj], or raises an error if the COM class is not known.}
|
|
||||||
|
|
||||||
@defproc[(set-coclass! [obj com-object?] [coclass string?]) void?]{
|
|
||||||
|
|
||||||
Sets the COM class for @scheme[obj] to @scheme[coclass]. This is
|
|
||||||
useful when MysterX COM event-handling procedures can obtain only
|
|
||||||
ambiguous information about the object's COM class.}
|
|
||||||
|
|
||||||
@defproc[(set-coclass-from-progid! [obj com-object?] [progid string?]) void?]{
|
|
||||||
|
|
||||||
Like @scheme[set-coclass!], but using a ProgID.}
|
|
||||||
|
|
||||||
@defproc[(com-methods [obj/type (or/c com-object? com-type?)])
|
|
||||||
(listof string?)]{
|
|
||||||
|
|
||||||
Returns a list of strings indicating the names of methods on
|
|
||||||
@scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-method-type [obj/type (or/c com-object? com-type?)]
|
|
||||||
[method-name string?])
|
|
||||||
(listof symbol?)]{
|
|
||||||
|
|
||||||
Returns a list of symbols indicating the type of the specified
|
|
||||||
method in @scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-invoke [obj com-object?] [method-name string?] [v any/c])
|
|
||||||
any/c]{
|
|
||||||
|
|
||||||
Invokes @scheme[method-name] on @scheme[obj] with @scheme[v]s as the
|
|
||||||
arguments. The special value @scheme[com-omit] may be used for
|
|
||||||
optional arguments, which useful when values are supplied for
|
|
||||||
arguments after the omitted argument(s).}
|
|
||||||
|
|
||||||
@defproc[(com-get-properties [obj/type (or/c com-object? com-type?)])
|
|
||||||
(listof string?)]{
|
|
||||||
|
|
||||||
Returns a list of strings indicating the names of readable
|
|
||||||
properties in @scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-get-property-type [obj/type (or/c com-object? com-type?)]
|
|
||||||
[property-name string?])
|
|
||||||
(listof symbol?)]{
|
|
||||||
|
|
||||||
Returns a list of symbols indicating the type of the specified
|
|
||||||
property in @scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-get-property [obj com-object?] [property string?] ...+)
|
|
||||||
any/c]{
|
|
||||||
|
|
||||||
Returns the value of the final property by following the indicated
|
|
||||||
path of @scheme[property]s, where each intermediate property is a
|
|
||||||
COM object.}
|
|
||||||
|
|
||||||
@defproc[(com-set-properties [obj/type (or/c com-object? com-type?)])
|
|
||||||
(listof string?)]{
|
|
||||||
|
|
||||||
Returns a list of strings indicating the names of writeable
|
|
||||||
properties in @scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-set-property-type [obj/type (or/c com-object? com-type?)]
|
|
||||||
[property-name strig?])
|
|
||||||
(listof symbol?)]{
|
|
||||||
|
|
||||||
Returns a list of symbols indicating the type of the specified
|
|
||||||
property in @scheme[obj/type].}
|
|
||||||
|
|
||||||
@defproc[(com-set-property! [obj com-object?]
|
|
||||||
[string? property] ...+
|
|
||||||
[v any/c])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Sets the value of the final property in @scheme[obj] to @scheme[v]
|
|
||||||
by following the @scheme[property]s, where the value of each
|
|
||||||
intermediate property is a COM object.}
|
|
||||||
|
|
||||||
@defproc[(com-help [obj/type (or/c com-object? com-type?)]
|
|
||||||
[topic string? ""])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Starts the Window Help system with help about the COM object or COM
|
|
||||||
type. The optional @scheme[topic] is typically a method or property
|
|
||||||
name.}
|
|
||||||
|
|
||||||
@defproc[(com-object-eq? [obj1 com-object?] [obj2 com-object?])
|
|
||||||
boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if the two COM objects are the same,
|
|
||||||
@scheme[#f] otherwise.}
|
|
||||||
|
|
||||||
@defproc[(com-object? [obj com-object?]) boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if the argument is a COM object, @scheme[#f]
|
|
||||||
otherwise.}
|
|
||||||
|
|
||||||
@defproc[(com-add-ref [obj com-object?]) void?]{
|
|
||||||
|
|
||||||
Increments the reference count for @scheme[obj].
|
|
||||||
This procedure should only be called when system-level
|
|
||||||
errors occur due to a mismanaged COM object. Ordinarily,
|
|
||||||
MysterX handles all COM reference-counting automatically.}
|
|
||||||
|
|
||||||
@defproc[(com-ref-count [obj com-object?]) exact-nonnegative-integer?]{
|
|
||||||
|
|
||||||
Returns a number indicating the current reference count
|
|
||||||
for a COM object.}
|
|
||||||
|
|
574
collects/mysterx/scribblings/html-element.scrbl
Normal file
574
collects/mysterx/scribblings/html-element.scrbl
Normal file
|
@ -0,0 +1,574 @@
|
||||||
|
#lang scribble/doc
|
||||||
|
@(require "common.ss"
|
||||||
|
scribble/bnf
|
||||||
|
scribble/decode
|
||||||
|
scribble/struct
|
||||||
|
(for-syntax scheme/base))
|
||||||
|
|
||||||
|
@(define-syntax-rule (filter-table (name (option0 contract0)
|
||||||
|
(option contract) ...) ...)
|
||||||
|
(let ([spacer (hspace 1)]
|
||||||
|
[to-flow (lambda (e)
|
||||||
|
(make-flow (list (make-paragraph (list e)))))])
|
||||||
|
(make-table
|
||||||
|
#f
|
||||||
|
(append
|
||||||
|
(list (list (to-flow spacer)
|
||||||
|
(to-flow @emph{filter})
|
||||||
|
(to-flow spacer)
|
||||||
|
(to-flow @emph{option})
|
||||||
|
(to-flow spacer)
|
||||||
|
(to-flow @emph{value})))
|
||||||
|
(list
|
||||||
|
(list (to-flow spacer)
|
||||||
|
(to-flow (scheme 'name))
|
||||||
|
(to-flow spacer)
|
||||||
|
(to-flow (scheme 'option0))
|
||||||
|
(to-flow spacer)
|
||||||
|
(make-flow (list (schemeblock0 contract0))))
|
||||||
|
(list (to-flow spacer)
|
||||||
|
(to-flow spacer)
|
||||||
|
(to-flow spacer)
|
||||||
|
(to-flow (scheme 'option))
|
||||||
|
(to-flow spacer)
|
||||||
|
(make-flow (list (schemeblock0 contract))))
|
||||||
|
...)
|
||||||
|
...))))
|
||||||
|
|
||||||
|
@(define-syntax-rule (argmatch id)
|
||||||
|
@elem{The argument must be a possible result from @method[mx-element% id].})
|
||||||
|
|
||||||
|
@(define-syntax-rule (resultmatch id)
|
||||||
|
@elem{Possible results are the same as for @method[mx-element% id].})
|
||||||
|
|
||||||
|
@(define-syntax-rule (valmatch id)
|
||||||
|
@elem{The non-string repersentation is the same as for @method[mx-element% id].})
|
||||||
|
|
||||||
|
@(define-syntax (defmethods stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ id contract . more)
|
||||||
|
(with-syntax ([id-native
|
||||||
|
(datum->syntax #'id
|
||||||
|
(string->symbol
|
||||||
|
(format "~s-native" (syntax-e #'id))))]
|
||||||
|
[set-id!
|
||||||
|
(datum->syntax #'id
|
||||||
|
(string->symbol
|
||||||
|
(format "set-~s!" (syntax-e #'id))))]
|
||||||
|
[set-id-native!
|
||||||
|
(datum->syntax #'id
|
||||||
|
(string->symbol
|
||||||
|
(format "set-~s-native!" (syntax-e #'id))))]
|
||||||
|
[css-string (format "~a" (syntax-e #'id))])
|
||||||
|
#'(make-splice
|
||||||
|
(list
|
||||||
|
@defmethod*[([(id) contract]
|
||||||
|
[(id-native) string?]
|
||||||
|
[(set-id! [v contract]) void?]
|
||||||
|
[(set-id-native! [str string?]) void?])]{
|
||||||
|
Retrieves or sets a value describing the CSS @tt[css-string] for
|
||||||
|
the element.
|
||||||
|
|
||||||
|
@(make-splice (list . more))})))]))
|
||||||
|
|
||||||
|
@(define-syntax-rule (defdef defXmethods ret-contract arg-contract)
|
||||||
|
(define-syntax (defXmethods stx)
|
||||||
|
(syntax-case stx ()
|
||||||
|
[(_ id)
|
||||||
|
(with-syntax ([set-id!
|
||||||
|
(datum->syntax #'id
|
||||||
|
(string->symbol
|
||||||
|
(format "set-~s!" (syntax-e #'id))))]
|
||||||
|
[css-string (format "~a" (syntax-e #'id))])
|
||||||
|
#'@defmethod*[([(id) ret-contract]
|
||||||
|
[(set-id! [v arg-contract]) void?])]{
|
||||||
|
Retrieves or sets the CSS @tt[css-string] for the element.})])))
|
||||||
|
|
||||||
|
@(defdef defboolmethods boolean? any/c)
|
||||||
|
@(defdef defintmethods exact-integer? exact-integer?)
|
||||||
|
@(defdef defrealmethods real? real?)
|
||||||
|
|
||||||
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@title[#:tag "html-element"]{HTML Elements}
|
||||||
|
|
||||||
|
@defclass[mx-element% object% ()]{
|
||||||
|
|
||||||
|
@defmethod[(get-html)
|
||||||
|
string?]{
|
||||||
|
|
||||||
|
Returns a string containing all the HTML between the pair of
|
||||||
|
tags represented by the element.}
|
||||||
|
|
||||||
|
@defmethod[(get-text)
|
||||||
|
string?]{
|
||||||
|
|
||||||
|
Returns a string containing just the text between the pair of
|
||||||
|
tags represented by the element. Any nested HTML tags
|
||||||
|
are not contained in the returned string.}
|
||||||
|
|
||||||
|
@defmethod[(insert-html [html string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Places the HTML given by the string @scheme[html] before the element.}
|
||||||
|
|
||||||
|
@defmethod[(append-html [html string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Places the HTML given by the string @scheme[html] after the element.}
|
||||||
|
|
||||||
|
@defmethod[(replace-html [html string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Replaces the HTML in the element with the string @scheme[html]. You
|
||||||
|
must use the @method[mx-document<%> find-element] or
|
||||||
|
@method[mx-document<%> find-element-by-id-or-name] methods of
|
||||||
|
@scheme[mx-document<%>] to retrieve the updated element.}
|
||||||
|
|
||||||
|
@defmethod[(insert-text [txt string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Places the text given by the string @scheme[txt] before the HTML element.}
|
||||||
|
|
||||||
|
@defmethod[(append-text [txt string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Places the text given by the string @scheme[txt] after the HTML element.}
|
||||||
|
|
||||||
|
@defmethod[(insert-object-from-coclass [coclass string?]
|
||||||
|
[width exact-integer?]
|
||||||
|
[height exact-integer?]
|
||||||
|
[size (one-of/c 'pixels 'percent) 'pixels])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Composes @scheme[coclass->html] with @method[mx-element% insert-html].}
|
||||||
|
|
||||||
|
@defmethod[(insert-object-from-progid [coclass string?]
|
||||||
|
[width exact-integer?]
|
||||||
|
[height exact-integer?]
|
||||||
|
[size (one-of/c 'pixels 'percent) 'pixels])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Composes @scheme[progid->html] with @method[mx-element% insert-html].}
|
||||||
|
|
||||||
|
@defmethod[(append-object-from-coclass [coclass string?]
|
||||||
|
[width exact-integer?]
|
||||||
|
[height exact-integer?]
|
||||||
|
[size (one-of/c 'pixels 'percent) 'pixels])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Composes @scheme[coclass->html] with @method[mx-element% append-html].}
|
||||||
|
|
||||||
|
@defmethod[(append-object-from-progid [coclass string?]
|
||||||
|
[width exact-integer?]
|
||||||
|
[height exact-integer?]
|
||||||
|
[size (one-of/c 'pixels 'percent) 'pixels])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Composes @scheme[progid->html] with @method[mx-element% append-html].}
|
||||||
|
|
||||||
|
@defmethod[(focus)
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Sets the focus to the element. This method works only with
|
||||||
|
Internet Explorer 5 and later.}
|
||||||
|
|
||||||
|
@defmethod[(selection)
|
||||||
|
string?]{
|
||||||
|
|
||||||
|
If the element has the @scheme["select"] tag, returns a string
|
||||||
|
indicating the value of the current selection. Otherwise, an
|
||||||
|
exception s raised. The value of the selection may be different
|
||||||
|
from the string visible in the dropdown list.}
|
||||||
|
|
||||||
|
@defmethod[(set-selection! [val string?])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
If the element has the @scheme["select"] tag, sets the selection to
|
||||||
|
the entry with the value @scheme[val], a string. Otherwise, an
|
||||||
|
exception is raised. The value of the selection may be different
|
||||||
|
from the string visible in the dropdown list.}
|
||||||
|
|
||||||
|
@defmethod[(attribute [attr string?])
|
||||||
|
(or/c string? real? boolean?)]{
|
||||||
|
|
||||||
|
Retrieves the attribute named by the string @scheme[attr]. The return
|
||||||
|
value has a type that depends on the attribute.}
|
||||||
|
|
||||||
|
@defmethod[(set-attribute! [attr string?]
|
||||||
|
[val (or/c string? real? boolean?)])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Sets the attribute named by the string @scheme[attr]. The new
|
||||||
|
value @scheme[val] has a type that depends on the attribute.}
|
||||||
|
|
||||||
|
@defmethod[(click)
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Simulates a mouse click on the element. }
|
||||||
|
|
||||||
|
@defmethod[(tag)
|
||||||
|
string?]{
|
||||||
|
|
||||||
|
Retrieves the element's HTML tag.}
|
||||||
|
|
||||||
|
@defmethods[font-family
|
||||||
|
(listof string?)]
|
||||||
|
|
||||||
|
@defmethods[font-style
|
||||||
|
(one-of/c 'normal 'italic 'oblique)]
|
||||||
|
|
||||||
|
@defmethods[font-variant
|
||||||
|
(one-of/c 'normal 'small-caps)]
|
||||||
|
@defmethods[font-weight
|
||||||
|
(one-of/c 'normal 'bold 'bolder 'lighter
|
||||||
|
100 200 300 400 500 600 700 800 900)]
|
||||||
|
|
||||||
|
@defmethod*[([(font-native) string?]
|
||||||
|
[(set-size-native! [fs string?]) void?])]{
|
||||||
|
|
||||||
|
Retrieves or sets a string that encodes the CSS @tt{font-style},
|
||||||
|
@tt{font-variant}, @tt{font-weight}, @tt{font-size},
|
||||||
|
@tt{line-height}, and @tt{font-family} using the format
|
||||||
|
|
||||||
|
@BNF-seq[@optional[@BNF-alt/close[@nonterm{font-style} @nonterm{font-variant} @nonterm{font-weight}]]
|
||||||
|
@nonterm{font-size}
|
||||||
|
@optional[@nonterm{line-height}]
|
||||||
|
@nonterm{font-family}]}
|
||||||
|
|
||||||
|
@defmethods[font-size
|
||||||
|
(or/c
|
||||||
|
(one-of/c
|
||||||
|
'xx-small 'x-small 'small 'medium 'large 'x-large 'xx-large
|
||||||
|
'larger 'smaller)
|
||||||
|
css-length?
|
||||||
|
css-percentage?)]
|
||||||
|
|
||||||
|
@defmethod*[([(background-native) string?]
|
||||||
|
[(set-background-native! [b string]) void?])]{
|
||||||
|
|
||||||
|
Gets or sets the element's CSS @tt{background-color}, @tt{background-image},
|
||||||
|
@tt{background-repeat}, @tt{background-attachment}, and @tt{background-position}
|
||||||
|
using the string @scheme[b].}
|
||||||
|
|
||||||
|
|
||||||
|
@defmethods[background-image
|
||||||
|
(or/c (one-of/c 'none) string?)]
|
||||||
|
|
||||||
|
@defmethods[background-repeat
|
||||||
|
(one-of/c 'no-repeat 'repeat 'repeat-x 'repeat-y)]
|
||||||
|
|
||||||
|
@defmethods[background-position
|
||||||
|
(or/c
|
||||||
|
css-length?
|
||||||
|
css-percentage?
|
||||||
|
(one-of/c 'left 'center 'right)
|
||||||
|
(list/c
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'left 'center 'right))
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'left 'center 'right))))]
|
||||||
|
|
||||||
|
@defmethods[text-decoration
|
||||||
|
(listof (one-of/c 'none 'underline 'overline 'line-through 'blink))]
|
||||||
|
|
||||||
|
@defmethods[text-transform
|
||||||
|
(one-of/c 'none 'capitalize 'uppercase 'lowercase)]
|
||||||
|
|
||||||
|
@defmethods[text-align
|
||||||
|
(one-of/c 'left 'right 'center 'justify)]
|
||||||
|
@defmethods[margin
|
||||||
|
(listof (or/c (one-of 'auto)
|
||||||
|
css-length?
|
||||||
|
css-percentage?))]{
|
||||||
|
|
||||||
|
A list representation contains one to four elements. A single
|
||||||
|
element applies to all sides; two elements are top--bottom and
|
||||||
|
left--right, respectively; four elements are top, left, bottom, and
|
||||||
|
right, respectively.}
|
||||||
|
|
||||||
|
|
||||||
|
@defmethods[padding
|
||||||
|
(listof (or/c css-length? css-percentage?))]{
|
||||||
|
|
||||||
|
The list contains one to four elements, which apply to sides as for
|
||||||
|
@method[mx-element% margin].}
|
||||||
|
|
||||||
|
@defmethods[border
|
||||||
|
(listof (or/c (or/c (one-of/c 'medium 'thin 'thick) css-length?)
|
||||||
|
(one-of/c 'none 'dotted 'dashed 'solid 'double
|
||||||
|
'groove 'ridge 'inset 'outset)
|
||||||
|
(or/c symbol? string?)))]{
|
||||||
|
|
||||||
|
Each element of the list describes a width, style, or color. A color
|
||||||
|
is a symbol indicating a color or an RGB string.}
|
||||||
|
|
||||||
|
@defmethods[border-top ....]{@valmatch[border]}
|
||||||
|
@defmethods[border-bottom ....]{@valmatch[border]}
|
||||||
|
@defmethods[border-left ....]{@valmatch[border]}
|
||||||
|
@defmethods[border-right ....]{@valmatch[border]}
|
||||||
|
|
||||||
|
@defmethods[border-color (listof (or/c symbol? string?))]{
|
||||||
|
|
||||||
|
The list contains one to four elements, with side assignments
|
||||||
|
as for @method[mx-element% margin].}
|
||||||
|
|
||||||
|
@defmethods[border-width
|
||||||
|
(listof (or/c css-length?
|
||||||
|
(one-of/c 'medium 'thin 'thick)))]{
|
||||||
|
|
||||||
|
The list contains one to four elements, with side assignments
|
||||||
|
as for @method[mx-element% margin].}
|
||||||
|
|
||||||
|
@defmethods[border-style
|
||||||
|
(one-of/c 'none 'dotted 'dashed 'solid 'double
|
||||||
|
'groove 'ridge 'inset 'outset)]
|
||||||
|
|
||||||
|
@defmethods[border-top-style ....]{@valmatch[border-style]}
|
||||||
|
@defmethods[border-bottom-style ....]{@valmatch[border-style]}
|
||||||
|
@defmethods[border-left-style ....]{@valmatch[border-style]}
|
||||||
|
@defmethods[border-right-style ....]{@valmatch[border-style]}
|
||||||
|
|
||||||
|
@defmethods[style-float
|
||||||
|
(one-of/c 'none 'left 'right)]
|
||||||
|
|
||||||
|
@defmethods[clear
|
||||||
|
(one-of/c 'none 'left 'right 'both)]
|
||||||
|
|
||||||
|
@defmethods[display
|
||||||
|
(one-of/c 'block 'none 'inline 'list-item
|
||||||
|
'table-header-group 'table-footer-group)]
|
||||||
|
|
||||||
|
@defmethods[visibility
|
||||||
|
(one-of/c 'inherit 'visible 'hidden)]
|
||||||
|
|
||||||
|
@defmethods[list-style-type
|
||||||
|
(one-of/c 'disc 'circle 'square 'decimal
|
||||||
|
'lower-roman 'upper-roman
|
||||||
|
'lower-alpha 'upper-alpha 'none)]
|
||||||
|
|
||||||
|
@defmethods[list-style-position
|
||||||
|
(one-of/c 'outside 'inside)]
|
||||||
|
|
||||||
|
@defmethods[list-style-image (lambda (s)
|
||||||
|
(and string?
|
||||||
|
(regexp-match? #rx"^(none|url[(].*[)])$" s)))]
|
||||||
|
|
||||||
|
@defmethods[list-style list?]{
|
||||||
|
|
||||||
|
A list representation contains one to three elements,
|
||||||
|
which have the same representations as for
|
||||||
|
@method[mx-element% list-style-type],
|
||||||
|
@method[mx-element% list-style-position],
|
||||||
|
and @method[mx-element% list-style-image]. The
|
||||||
|
values may appear in any order.}
|
||||||
|
|
||||||
|
@defmethods[position
|
||||||
|
(one-of/c 'absolute 'relative 'static)]
|
||||||
|
|
||||||
|
@defmethods[overflow
|
||||||
|
(one-of/c 'visible 'scroll 'hidden 'auto)]
|
||||||
|
|
||||||
|
@defmethods[pagebreak-before
|
||||||
|
(one-of/c 'always 'auto 'none)]
|
||||||
|
@defmethods[pagebreak-after
|
||||||
|
(one-of/c 'always 'auto 'none)]
|
||||||
|
|
||||||
|
@defmethod*[([(css-text-native) string?]
|
||||||
|
[(set-css-text-native! [txt string?]) void?])]{
|
||||||
|
|
||||||
|
Retrieves or sets a string describing the CSS @tt{text} for
|
||||||
|
the element.}
|
||||||
|
|
||||||
|
@defmethods[cursor
|
||||||
|
(one-of/c 'auto 'crosshair 'default
|
||||||
|
'hand 'move 'n-resize 'ne-resize 'nw-resize 's-resize
|
||||||
|
'se-resize 'sw-resize 'e-resize 'w-resize 'text 'wait
|
||||||
|
'help)]
|
||||||
|
|
||||||
|
@defmethods[clip
|
||||||
|
(or/c (one-of/c 'auto)
|
||||||
|
(list/c (or/c (one-of/c 'auto)
|
||||||
|
css-length?)
|
||||||
|
(or/c (one-of/c 'auto)
|
||||||
|
css-length?)
|
||||||
|
(or/c (one-of/c 'auto)
|
||||||
|
css-length?)
|
||||||
|
(or/c (one-of/c 'auto)
|
||||||
|
css-length?)))]
|
||||||
|
|
||||||
|
@defmethods[filter
|
||||||
|
(cons/c symbol? (listof (list/c symbol? any/c)))]{
|
||||||
|
|
||||||
|
For a filter value that combines a symbol with a list, the symbol is
|
||||||
|
a filter name, and the list maps symbol option names to values. The
|
||||||
|
table below shows the possible options and value types for each
|
||||||
|
possible filter name.
|
||||||
|
|
||||||
|
@filter-table[
|
||||||
|
( alpha (enabled boolean?)
|
||||||
|
(finish-opacity (integer-in 0 100))
|
||||||
|
(opacity (integer-in 0 100))
|
||||||
|
(start-x exact-integer?)
|
||||||
|
(start-y exact-integer?)
|
||||||
|
(finish-x exact-integer?)
|
||||||
|
(finish-y exact-integer?)
|
||||||
|
(style (one-of/c 'uniform
|
||||||
|
'linear
|
||||||
|
'radial
|
||||||
|
'rectangular)))
|
||||||
|
( blend-trans (enable boolean?)
|
||||||
|
(duration real?)
|
||||||
|
(status (one-of/c 'stopped
|
||||||
|
'applied
|
||||||
|
'playing)))
|
||||||
|
( blur (add boolean?)
|
||||||
|
(enabled boolean?)
|
||||||
|
(direction (one-of/c 0 45 90
|
||||||
|
135 180
|
||||||
|
225 270
|
||||||
|
315))
|
||||||
|
(strength (integer-in 1 100)))
|
||||||
|
( chroma (enabled boolean?)
|
||||||
|
(color string?))
|
||||||
|
( drop-shadow (enabled boolean?)
|
||||||
|
(off-x exact-integer?)
|
||||||
|
(off-y exact-integer?))
|
||||||
|
( flip-horizontal (enabled boolean?))
|
||||||
|
( flip-vertical (enabled boolean?))
|
||||||
|
( glow (enabled boolean?)
|
||||||
|
(color string?)
|
||||||
|
(strength (integer-in 1 100)))
|
||||||
|
( gray (enabled boolean?))
|
||||||
|
( invert (enabled boolean?))
|
||||||
|
( light (enabled boolean?))
|
||||||
|
( mask (enabled boolean?)
|
||||||
|
(color string?))
|
||||||
|
( redirect (enabled boolean?))
|
||||||
|
( reveal-trans (enabled boolean?)
|
||||||
|
(duration real?)
|
||||||
|
(status (one-of/c 'stopped
|
||||||
|
'applied
|
||||||
|
'playing)))
|
||||||
|
( shadow (enabled boolean?)
|
||||||
|
(color string?)
|
||||||
|
(direction (one-of/c 0 45 90
|
||||||
|
135 180
|
||||||
|
225 270
|
||||||
|
315)))
|
||||||
|
( wave (enabled boolean?)
|
||||||
|
(freq (and/c real?
|
||||||
|
(not/c negative?)))
|
||||||
|
(light-strength (integer-in 1 100)))
|
||||||
|
( x-ray (enabled boolean?))
|
||||||
|
]}
|
||||||
|
|
||||||
|
@defmethod[(style-string)
|
||||||
|
string?]{
|
||||||
|
|
||||||
|
Retrieves a string describing the complete CSS
|
||||||
|
description for the element.}
|
||||||
|
|
||||||
|
@defboolmethods[text-decoration-none]
|
||||||
|
@defboolmethods[text-decoration-underline]
|
||||||
|
@defboolmethods[text-decoration-overline]
|
||||||
|
@defboolmethods[text-decoration-linethrough]
|
||||||
|
@defboolmethods[text-decoration-blink]
|
||||||
|
|
||||||
|
@defintmethods[pixel-top]
|
||||||
|
@defintmethods[pixel-left]
|
||||||
|
@defintmethods[pixel-width]
|
||||||
|
@defintmethods[pixel-height]
|
||||||
|
|
||||||
|
@defrealmethods[pos-top]
|
||||||
|
@defrealmethods[pos-left]
|
||||||
|
@defrealmethods[pos-width]
|
||||||
|
@defrealmethods[pos-height]
|
||||||
|
|
||||||
|
@defmethods[color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
@defmethods[background-color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
|
||||||
|
@defmethods[background-position-x
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'left 'center 'right))]
|
||||||
|
@defmethods[background-position-y
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'left 'center 'right))]
|
||||||
|
|
||||||
|
@defmethods[letter-spacing
|
||||||
|
(or/c css-length? (one-of/c 'normal))]
|
||||||
|
|
||||||
|
@defmethods[vertical-align
|
||||||
|
(one-of/c 'baseline 'sub 'super 'top 'middle
|
||||||
|
'bottom 'text-top 'text-bottom)]
|
||||||
|
@defmethods[text-indent
|
||||||
|
(or/c css-length? css-percentage?)]
|
||||||
|
|
||||||
|
@defmethods[line-height
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'normal))]
|
||||||
|
|
||||||
|
@defmethods[margin-top
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
@defmethods[margin-bottom
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
@defmethods[margin-left
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
@defmethods[margin-right
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
|
||||||
|
@defmethods[padding-top
|
||||||
|
(or/c css-length? css-percentage?)]
|
||||||
|
@defmethods[padding-bottom
|
||||||
|
(or/c css-length? css-percentage?)]
|
||||||
|
@defmethods[padding-left
|
||||||
|
(or/c css-length? css-percentage?)]
|
||||||
|
@defmethods[padding-right
|
||||||
|
(or/c css-length? css-percentage?)]
|
||||||
|
|
||||||
|
@defmethods[border-top-color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
@defmethods[border-bottom-color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
@defmethods[border-left-color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
@defmethods[border-right-color
|
||||||
|
(or/c symbol? string?)]
|
||||||
|
|
||||||
|
@defmethods[border-top-width
|
||||||
|
(or/c css-length?
|
||||||
|
(one-of/c 'medium 'thin 'thick))]
|
||||||
|
@defmethods[border-bottom-width
|
||||||
|
(or/c css-length?
|
||||||
|
(one-of/c 'medium 'thin 'thick))]
|
||||||
|
@defmethods[border-left-width
|
||||||
|
(or/c css-length?
|
||||||
|
(one-of/c 'medium 'thin 'thick))]
|
||||||
|
@defmethods[border-right-width
|
||||||
|
(or/c css-length?
|
||||||
|
(one-of/c 'medium 'thin 'thick))]
|
||||||
|
|
||||||
|
@defmethods[width
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
@defmethods[height
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
|
||||||
|
@defmethods[top
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
@defmethods[left
|
||||||
|
(or/c css-length? css-percentage?
|
||||||
|
(one-of/c 'auto))]
|
||||||
|
|
||||||
|
@defmethods[z-index
|
||||||
|
(or/c exact-integer? (one-of/c 'auto))]
|
||||||
|
|
||||||
|
}
|
|
@ -1,97 +1,32 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "common.ss"
|
@(require "common.ss")
|
||||||
scribble/bnf
|
|
||||||
scribble/decode
|
|
||||||
scribble/struct
|
|
||||||
(for-syntax scheme/base))
|
|
||||||
|
|
||||||
|
|
||||||
@(define-syntax-rule (filter-table (name (option0 contract0)
|
|
||||||
(option contract) ...) ...)
|
|
||||||
(let ([spacer (hspace 1)]
|
|
||||||
[to-flow (lambda (e)
|
|
||||||
(make-flow (list (make-paragraph (list e)))))])
|
|
||||||
(make-table
|
|
||||||
#f
|
|
||||||
(append
|
|
||||||
(list (list (to-flow spacer)
|
|
||||||
(to-flow @emph{filter})
|
|
||||||
(to-flow spacer)
|
|
||||||
(to-flow @emph{option})
|
|
||||||
(to-flow spacer)
|
|
||||||
(to-flow @emph{value})))
|
|
||||||
(list
|
|
||||||
(list (to-flow spacer)
|
|
||||||
(to-flow (scheme 'name))
|
|
||||||
(to-flow spacer)
|
|
||||||
(to-flow (scheme 'option0))
|
|
||||||
(to-flow spacer)
|
|
||||||
(make-flow (list (schemeblock0 contract0))))
|
|
||||||
(list (to-flow spacer)
|
|
||||||
(to-flow spacer)
|
|
||||||
(to-flow spacer)
|
|
||||||
(to-flow (scheme 'option))
|
|
||||||
(to-flow spacer)
|
|
||||||
(make-flow (list (schemeblock0 contract))))
|
|
||||||
...)
|
|
||||||
...))))
|
|
||||||
|
|
||||||
@(define-syntax-rule (argmatch id)
|
|
||||||
@elem{The argument must be a possible result from @method[mx-element% id].})
|
|
||||||
|
|
||||||
@(define-syntax-rule (resultmatch id)
|
|
||||||
@elem{Possible results are the same as for @method[mx-element% id].})
|
|
||||||
|
|
||||||
@(define-syntax-rule (valmatch id)
|
|
||||||
@elem{The non-string repersentation is the same as for @method[mx-element% id].})
|
|
||||||
|
|
||||||
@(define-syntax (defmethods stx)
|
|
||||||
(syntax-case stx ()
|
|
||||||
[(_ id contract . more)
|
|
||||||
(with-syntax ([id-native
|
|
||||||
(datum->syntax #'id
|
|
||||||
(string->symbol
|
|
||||||
(format "~s-native" (syntax-e #'id))))]
|
|
||||||
[set-id!
|
|
||||||
(datum->syntax #'id
|
|
||||||
(string->symbol
|
|
||||||
(format "set-~s!" (syntax-e #'id))))]
|
|
||||||
[set-id-native!
|
|
||||||
(datum->syntax #'id
|
|
||||||
(string->symbol
|
|
||||||
(format "set-~s-native!" (syntax-e #'id))))]
|
|
||||||
[css-string (format "~a" (syntax-e #'id))])
|
|
||||||
#'(make-splice
|
|
||||||
(list
|
|
||||||
@defmethod*[([(id) contract]
|
|
||||||
[(id-native) string?]
|
|
||||||
[(set-id! [v contract]) void?]
|
|
||||||
[(set-id-native! [str string?]) void?])]{
|
|
||||||
Retrieves or sets a value describing the CSS @tt[css-string] for
|
|
||||||
the element.
|
|
||||||
|
|
||||||
@(make-splice (list . more))})))]))
|
|
||||||
|
|
||||||
@(define-syntax-rule (defdef defXmethods ret-contract arg-contract)
|
|
||||||
(define-syntax (defXmethods stx)
|
|
||||||
(syntax-case stx ()
|
|
||||||
[(_ id)
|
|
||||||
(with-syntax ([set-id!
|
|
||||||
(datum->syntax #'id
|
|
||||||
(string->symbol
|
|
||||||
(format "set-~s!" (syntax-e #'id))))]
|
|
||||||
[css-string (format "~a" (syntax-e #'id))])
|
|
||||||
#'@defmethod*[([(id) ret-contract]
|
|
||||||
[(set-id! [v arg-contract]) void?])]{
|
|
||||||
Retrieves or sets the CSS @tt[css-string] for the element.})])))
|
|
||||||
|
|
||||||
@(defdef defboolmethods boolean? any/c)
|
|
||||||
@(defdef defintmethods exact-integer? exact-integer?)
|
|
||||||
@(defdef defrealmethods real? real?)
|
|
||||||
|
|
||||||
@; ----------------------------------------------------------------------
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
@title[#:tag "html"]{HTML and Dynamic HTML}
|
@title[#:tag "html" #:style 'toc]{HTML and Dynamic HTML}
|
||||||
|
|
||||||
|
The @scheme[mx-element%] class encapsulates HTML elements. By
|
||||||
|
calling the methods of the class, you can change the appearance of
|
||||||
|
elements, and place new HTML before or after the element. While the
|
||||||
|
methods are described here, a good DHTML reference, such as
|
||||||
|
Goodman's @italic{Dynamic HTML} will have more complete information.
|
||||||
|
|
||||||
|
Many of the @scheme[mx-element%] methods have two variants, a
|
||||||
|
version that takes or returns Scheme data, and another
|
||||||
|
@schemeidfont{-native} version that takes or returns a string. For
|
||||||
|
methods that return values of element properties, we assume two
|
||||||
|
characteristics, which we do not mention in the methods'
|
||||||
|
documentation: 1) Native methods return the empty string for
|
||||||
|
properties that have not been set, and 2) non-native methods raise
|
||||||
|
an error for properties that have not been set.
|
||||||
|
|
||||||
|
@; ----------------------------------------
|
||||||
|
|
||||||
|
@include-section["html-element.scrbl"]
|
||||||
|
|
||||||
|
@; ----------------------------------------
|
||||||
|
|
||||||
|
@section{Generating ActiveX HTML}
|
||||||
|
|
||||||
@deftogether[(
|
@deftogether[(
|
||||||
@defproc[(coclass->html [name string?]
|
@defproc[(coclass->html [name string?]
|
||||||
|
@ -115,24 +50,9 @@
|
||||||
also be @scheme['percent], indicating that the width and height are
|
also be @scheme['percent], indicating that the width and height are
|
||||||
a fixed percentage of the document window size.}
|
a fixed percentage of the document window size.}
|
||||||
|
|
||||||
@section{HTML Elements}
|
@; ----------------------------------------
|
||||||
|
|
||||||
The @scheme[mx-element%] class encapsulates HTML elements. By
|
@section{CSS}
|
||||||
calling the methods of the class, you can change the appearance of
|
|
||||||
elements, and place new HTML before or after the element. While the
|
|
||||||
methods are described here, a good DHTML reference, such as
|
|
||||||
Goodman's @italic{Dynamic HTML} will have more complete information.
|
|
||||||
|
|
||||||
Many of the @scheme[mx-element%] methods have two variants, a
|
|
||||||
version that takes or returns Scheme data, and another
|
|
||||||
@schemeidfont{-native} version that takes or returns a string. For
|
|
||||||
methods that return values of element properties, we assume two
|
|
||||||
characteristics, which we do not mention in the methods'
|
|
||||||
documentation: 1) Native methods return the empty string for
|
|
||||||
properties that have not been set, and 2) non-native methods raise
|
|
||||||
an error for properties that have not been set.
|
|
||||||
|
|
||||||
@subsection{CSS}
|
|
||||||
|
|
||||||
In the @scheme[mx-element%] method descriptions, ``CSS'' refers to
|
In the @scheme[mx-element%] method descriptions, ``CSS'' refers to
|
||||||
the Cascading Style Sheets specification. A CSS length is string
|
the Cascading Style Sheets specification. A CSS length is string
|
||||||
|
@ -152,7 +72,9 @@
|
||||||
@defstruct[css-length ([num real?][units (symbols em ex cm mm in pt pc px)])]
|
@defstruct[css-length ([num real?][units (symbols em ex cm mm in pt pc px)])]
|
||||||
)]
|
)]
|
||||||
|
|
||||||
@subsection{Colors}
|
@; ----------------------------------------
|
||||||
|
|
||||||
|
@section{Colors}
|
||||||
|
|
||||||
Many element properties represent colors. In HTML, colors may be
|
Many element properties represent colors. In HTML, colors may be
|
||||||
represented by an RGB string, which contains 7 characters. The first
|
represented by an RGB string, which contains 7 characters. The first
|
||||||
|
@ -205,483 +127,3 @@
|
||||||
yellowgreen
|
yellowgreen
|
||||||
}
|
}
|
||||||
|
|
||||||
@defclass[mx-element% object% ()]{
|
|
||||||
|
|
||||||
@defmethod[(get-html)
|
|
||||||
string?]{
|
|
||||||
|
|
||||||
Returns a string containing all the HTML between the pair of
|
|
||||||
tags represented by the element.}
|
|
||||||
|
|
||||||
@defmethod[(get-text)
|
|
||||||
string?]{
|
|
||||||
|
|
||||||
Returns a string containing just the text between the pair of
|
|
||||||
tags represented by the element. Any nested HTML tags
|
|
||||||
are not contained in the returned string.}
|
|
||||||
|
|
||||||
@defmethod[(insert-html [html string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Places the HTML given by the string @scheme[html] before the element.}
|
|
||||||
|
|
||||||
@defmethod[(append-html [html string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Places the HTML given by the string @scheme[html] after the element.}
|
|
||||||
|
|
||||||
@defmethod[(replace-html [html string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Replaces the HTML in the element with the string @scheme[html]. You
|
|
||||||
must use the @method[mx-document<%> find-element] or
|
|
||||||
@method[mx-document<%> find-element-by-id-or-name] methods of
|
|
||||||
@scheme[mx-document<%>] to retrieve the updated element.}
|
|
||||||
|
|
||||||
@defmethod[(insert-text [txt string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Places the text given by the string @scheme[txt] before the HTML element.}
|
|
||||||
|
|
||||||
@defmethod[(append-text [txt string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Places the text given by the string @scheme[txt] after the HTML element.}
|
|
||||||
|
|
||||||
@defmethod[(insert-object-from-coclass [coclass string?]
|
|
||||||
[width exact-integer?]
|
|
||||||
[height exact-integer?]
|
|
||||||
[size (one-of/c 'pixels 'percent) 'pixels])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Composes @scheme[coclass->html] with @method[mx-element% insert-html].}
|
|
||||||
|
|
||||||
@defmethod[(insert-object-from-progid [coclass string?]
|
|
||||||
[width exact-integer?]
|
|
||||||
[height exact-integer?]
|
|
||||||
[size (one-of/c 'pixels 'percent) 'pixels])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Composes @scheme[progid->html] with @method[mx-element% insert-html].}
|
|
||||||
|
|
||||||
@defmethod[(append-object-from-coclass [coclass string?]
|
|
||||||
[width exact-integer?]
|
|
||||||
[height exact-integer?]
|
|
||||||
[size (one-of/c 'pixels 'percent) 'pixels])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Composes @scheme[coclass->html] with @method[mx-element% append-html].}
|
|
||||||
|
|
||||||
@defmethod[(append-object-from-progid [coclass string?]
|
|
||||||
[width exact-integer?]
|
|
||||||
[height exact-integer?]
|
|
||||||
[size (one-of/c 'pixels 'percent) 'pixels])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Composes @scheme[progid->html] with @method[mx-element% append-html].}
|
|
||||||
|
|
||||||
@defmethod[(focus)
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Sets the focus to the element. This method works only with
|
|
||||||
Internet Explorer 5 and later.}
|
|
||||||
|
|
||||||
@defmethod[(selection)
|
|
||||||
string?]{
|
|
||||||
|
|
||||||
If the element has the @scheme["select"] tag, returns a string
|
|
||||||
indicating the value of the current selection. Otherwise, an
|
|
||||||
exception s raised. The value of the selection may be different
|
|
||||||
from the string visible in the dropdown list.}
|
|
||||||
|
|
||||||
@defmethod[(set-selection! [val string?])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
If the element has the @scheme["select"] tag, sets the selection to
|
|
||||||
the entry with the value @scheme[val], a string. Otherwise, an
|
|
||||||
exception is raised. The value of the selection may be different
|
|
||||||
from the string visible in the dropdown list.}
|
|
||||||
|
|
||||||
@defmethod[(attribute [attr string?])
|
|
||||||
(or/c string? real? boolean?)]{
|
|
||||||
|
|
||||||
Retrieves the attribute named by the string @scheme[attr]. The return
|
|
||||||
value has a type that depends on the attribute.}
|
|
||||||
|
|
||||||
@defmethod[(set-attribute! [attr string?]
|
|
||||||
[val (or/c string? real? boolean?)])
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Sets the attribute named by the string @scheme[attr]. The new
|
|
||||||
value @scheme[val] has a type that depends on the attribute.}
|
|
||||||
|
|
||||||
@defmethod[(click)
|
|
||||||
void?]{
|
|
||||||
|
|
||||||
Simulates a mouse click on the element. }
|
|
||||||
|
|
||||||
@defmethod[(tag)
|
|
||||||
string?]{
|
|
||||||
|
|
||||||
Retrieves the element's HTML tag.}
|
|
||||||
|
|
||||||
@defmethods[font-family
|
|
||||||
(listof string?)]
|
|
||||||
|
|
||||||
@defmethods[font-style
|
|
||||||
(one-of/c 'normal 'italic 'oblique)]
|
|
||||||
|
|
||||||
@defmethods[font-variant
|
|
||||||
(one-of/c 'normal 'small-caps)]
|
|
||||||
@defmethods[font-weight
|
|
||||||
(one-of/c 'normal 'bold 'bolder 'lighter
|
|
||||||
100 200 300 400 500 600 700 800 900)]
|
|
||||||
|
|
||||||
@defmethod*[([(font-native) string?]
|
|
||||||
[(set-size-native! [fs string?]) void?])]{
|
|
||||||
|
|
||||||
Retrieves or sets a string that encodes the CSS @tt{font-style},
|
|
||||||
@tt{font-variant}, @tt{font-weight}, @tt{font-size},
|
|
||||||
@tt{line-height}, and @tt{font-family} using the format
|
|
||||||
|
|
||||||
@BNF-seq[@optional[@BNF-alt/close[@nonterm{font-style} @nonterm{font-variant} @nonterm{font-weight}]]
|
|
||||||
@nonterm{font-size}
|
|
||||||
@optional[@nonterm{line-height}]
|
|
||||||
@nonterm{font-family}]}
|
|
||||||
|
|
||||||
@defmethods[font-size
|
|
||||||
(or/c
|
|
||||||
(one-of/c
|
|
||||||
'xx-small 'x-small 'small 'medium 'large 'x-large 'xx-large
|
|
||||||
'larger 'smaller)
|
|
||||||
css-length?
|
|
||||||
css-percentage?)]
|
|
||||||
|
|
||||||
@defmethod*[([(background-native) string?]
|
|
||||||
[(set-background-native! [b string]) void?])]{
|
|
||||||
|
|
||||||
Gets or sets the element's CSS @tt{background-color}, @tt{background-image},
|
|
||||||
@tt{background-repeat}, @tt{background-attachment}, and @tt{background-position}
|
|
||||||
using the string @scheme[b].}
|
|
||||||
|
|
||||||
|
|
||||||
@defmethods[background-image
|
|
||||||
(or/c (one-of/c 'none) string?)]
|
|
||||||
|
|
||||||
@defmethods[background-repeat
|
|
||||||
(one-of/c 'no-repeat 'repeat 'repeat-x 'repeat-y)]
|
|
||||||
|
|
||||||
@defmethods[background-position
|
|
||||||
(or/c
|
|
||||||
css-length?
|
|
||||||
css-percentage?
|
|
||||||
(one-of/c 'left 'center 'right)
|
|
||||||
(list/c
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'left 'center 'right))
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'left 'center 'right))))]
|
|
||||||
|
|
||||||
@defmethods[text-decoration
|
|
||||||
(listof (one-of/c 'none 'underline 'overline 'line-through 'blink))]
|
|
||||||
|
|
||||||
@defmethods[text-transform
|
|
||||||
(one-of/c 'none 'capitalize 'uppercase 'lowercase)]
|
|
||||||
|
|
||||||
@defmethods[text-align
|
|
||||||
(one-of/c 'left 'right 'center 'justify)]
|
|
||||||
@defmethods[margin
|
|
||||||
(listof (or/c (one-of 'auto)
|
|
||||||
css-length?
|
|
||||||
css-percentage?))]{
|
|
||||||
|
|
||||||
A list representation contains one to four elements. A single
|
|
||||||
element applies to all sides; two elements are top--bottom and
|
|
||||||
left--right, respectively; four elements are top, left, bottom, and
|
|
||||||
right, respectively.}
|
|
||||||
|
|
||||||
|
|
||||||
@defmethods[padding
|
|
||||||
(listof (or/c css-length? css-percentage?))]{
|
|
||||||
|
|
||||||
The list contains one to four elements, which apply to sides as for
|
|
||||||
@method[mx-element% margin].}
|
|
||||||
|
|
||||||
@defmethods[border
|
|
||||||
(listof (or/c (or/c (one-of/c 'medium 'thin 'thick) css-length?)
|
|
||||||
(one-of/c 'none 'dotted 'dashed 'solid 'double
|
|
||||||
'groove 'ridge 'inset 'outset)
|
|
||||||
(or/c symbol? string?)))]{
|
|
||||||
|
|
||||||
Each element of the list describes a width, style, or color. A color
|
|
||||||
is a symbol indicating a color or an RGB string.}
|
|
||||||
|
|
||||||
@defmethods[border-top ....]{@valmatch[border]}
|
|
||||||
@defmethods[border-bottom ....]{@valmatch[border]}
|
|
||||||
@defmethods[border-left ....]{@valmatch[border]}
|
|
||||||
@defmethods[border-right ....]{@valmatch[border]}
|
|
||||||
|
|
||||||
@defmethods[border-color (listof (or/c symbol? string?))]{
|
|
||||||
|
|
||||||
The list contains one to four elements, with side assignments
|
|
||||||
as for @method[mx-element% margin].}
|
|
||||||
|
|
||||||
@defmethods[border-width
|
|
||||||
(listof (or/c css-length?
|
|
||||||
(one-of/c 'medium 'thin 'thick)))]{
|
|
||||||
|
|
||||||
The list contains one to four elements, with side assignments
|
|
||||||
as for @method[mx-element% margin].}
|
|
||||||
|
|
||||||
@defmethods[border-style
|
|
||||||
(one-of/c 'none 'dotted 'dashed 'solid 'double
|
|
||||||
'groove 'ridge 'inset 'outset)]
|
|
||||||
|
|
||||||
@defmethods[border-top-style ....]{@valmatch[border-style]}
|
|
||||||
@defmethods[border-bottom-style ....]{@valmatch[border-style]}
|
|
||||||
@defmethods[border-left-style ....]{@valmatch[border-style]}
|
|
||||||
@defmethods[border-right-style ....]{@valmatch[border-style]}
|
|
||||||
|
|
||||||
@defmethods[style-float
|
|
||||||
(one-of/c 'none 'left 'right)]
|
|
||||||
|
|
||||||
@defmethods[clear
|
|
||||||
(one-of/c 'none 'left 'right 'both)]
|
|
||||||
|
|
||||||
@defmethods[display
|
|
||||||
(one-of/c 'block 'none 'inline 'list-item
|
|
||||||
'table-header-group 'table-footer-group)]
|
|
||||||
|
|
||||||
@defmethods[visibility
|
|
||||||
(one-of/c 'inherit 'visible 'hidden)]
|
|
||||||
|
|
||||||
@defmethods[list-style-type
|
|
||||||
(one-of/c 'disc 'circle 'square 'decimal
|
|
||||||
'lower-roman 'upper-roman
|
|
||||||
'lower-alpha 'upper-alpha 'none)]
|
|
||||||
|
|
||||||
@defmethods[list-style-position
|
|
||||||
(one-of/c 'outside 'inside)]
|
|
||||||
|
|
||||||
@defmethods[list-style-image (lambda (s)
|
|
||||||
(and string?
|
|
||||||
(regexp-match? #rx"^(none|url[(].*[)])$" s)))]
|
|
||||||
|
|
||||||
@defmethods[list-style list?]{
|
|
||||||
|
|
||||||
A list representation contains one to three elements,
|
|
||||||
which have the same representations as for
|
|
||||||
@method[mx-element% list-style-type],
|
|
||||||
@method[mx-element% list-style-position],
|
|
||||||
and @method[mx-element% list-style-image]. The
|
|
||||||
values may appear in any order.}
|
|
||||||
|
|
||||||
@defmethods[position
|
|
||||||
(one-of/c 'absolute 'relative 'static)]
|
|
||||||
|
|
||||||
@defmethods[overflow
|
|
||||||
(one-of/c 'visible 'scroll 'hidden 'auto)]
|
|
||||||
|
|
||||||
@defmethods[pagebreak-before
|
|
||||||
(one-of/c 'always 'auto 'none)]
|
|
||||||
@defmethods[pagebreak-after
|
|
||||||
(one-of/c 'always 'auto 'none)]
|
|
||||||
|
|
||||||
@defmethod*[([(css-text-native) string?]
|
|
||||||
[(set-css-text-native! [txt string?]) void?])]{
|
|
||||||
|
|
||||||
Retrieves or sets a string describing the CSS @tt{text} for
|
|
||||||
the element.}
|
|
||||||
|
|
||||||
@defmethods[cursor
|
|
||||||
(one-of/c 'auto 'crosshair 'default
|
|
||||||
'hand 'move 'n-resize 'ne-resize 'nw-resize 's-resize
|
|
||||||
'se-resize 'sw-resize 'e-resize 'w-resize 'text 'wait
|
|
||||||
'help)]
|
|
||||||
|
|
||||||
@defmethods[clip
|
|
||||||
(or/c (one-of/c 'auto)
|
|
||||||
(list/c (or/c (one-of/c 'auto)
|
|
||||||
css-length?)
|
|
||||||
(or/c (one-of/c 'auto)
|
|
||||||
css-length?)
|
|
||||||
(or/c (one-of/c 'auto)
|
|
||||||
css-length?)
|
|
||||||
(or/c (one-of/c 'auto)
|
|
||||||
css-length?)))]
|
|
||||||
|
|
||||||
@defmethods[filter
|
|
||||||
(cons/c symbol? (listof (list/c symbol? any/c)))]{
|
|
||||||
|
|
||||||
For a filter value that combines a symbol with a list, the symbol is
|
|
||||||
a filter name, and the list maps symbol option names to values. The
|
|
||||||
table below shows the possible options and value types for each
|
|
||||||
possible filter name.
|
|
||||||
|
|
||||||
@filter-table[
|
|
||||||
( alpha (enabled boolean?)
|
|
||||||
(finish-opacity (integer-in 0 100))
|
|
||||||
(opacity (integer-in 0 100))
|
|
||||||
(start-x exact-integer?)
|
|
||||||
(start-y exact-integer?)
|
|
||||||
(finish-x exact-integer?)
|
|
||||||
(finish-y exact-integer?)
|
|
||||||
(style (one-of/c 'uniform
|
|
||||||
'linear
|
|
||||||
'radial
|
|
||||||
'rectangular)))
|
|
||||||
( blend-trans (enable boolean?)
|
|
||||||
(duration real?)
|
|
||||||
(status (one-of/c 'stopped
|
|
||||||
'applied
|
|
||||||
'playing)))
|
|
||||||
( blur (add boolean?)
|
|
||||||
(enabled boolean?)
|
|
||||||
(direction (one-of/c 0 45 90
|
|
||||||
135 180
|
|
||||||
225 270
|
|
||||||
315))
|
|
||||||
(strength (integer-in 1 100)))
|
|
||||||
( chroma (enabled boolean?)
|
|
||||||
(color string?))
|
|
||||||
( drop-shadow (enabled boolean?)
|
|
||||||
(off-x exact-integer?)
|
|
||||||
(off-y exact-integer?))
|
|
||||||
( flip-horizontal (enabled boolean?))
|
|
||||||
( flip-vertical (enabled boolean?))
|
|
||||||
( glow (enabled boolean?)
|
|
||||||
(color string?)
|
|
||||||
(strength (integer-in 1 100)))
|
|
||||||
( gray (enabled boolean?))
|
|
||||||
( invert (enabled boolean?))
|
|
||||||
( light (enabled boolean?))
|
|
||||||
( mask (enabled boolean?)
|
|
||||||
(color string?))
|
|
||||||
( redirect (enabled boolean?))
|
|
||||||
( reveal-trans (enabled boolean?)
|
|
||||||
(duration real?)
|
|
||||||
(status (one-of/c 'stopped
|
|
||||||
'applied
|
|
||||||
'playing)))
|
|
||||||
( shadow (enabled boolean?)
|
|
||||||
(color string?)
|
|
||||||
(direction (one-of/c 0 45 90
|
|
||||||
135 180
|
|
||||||
225 270
|
|
||||||
315)))
|
|
||||||
( wave (enabled boolean?)
|
|
||||||
(freq (and/c real?
|
|
||||||
(not/c negative?)))
|
|
||||||
(light-strength (integer-in 1 100)))
|
|
||||||
( x-ray (enabled boolean?))
|
|
||||||
]}
|
|
||||||
|
|
||||||
@defmethod[(style-string)
|
|
||||||
string?]{
|
|
||||||
|
|
||||||
Retrieves a string describing the complete CSS
|
|
||||||
description for the element.}
|
|
||||||
|
|
||||||
@defboolmethods[text-decoration-none]
|
|
||||||
@defboolmethods[text-decoration-underline]
|
|
||||||
@defboolmethods[text-decoration-overline]
|
|
||||||
@defboolmethods[text-decoration-linethrough]
|
|
||||||
@defboolmethods[text-decoration-blink]
|
|
||||||
|
|
||||||
@defintmethods[pixel-top]
|
|
||||||
@defintmethods[pixel-left]
|
|
||||||
@defintmethods[pixel-width]
|
|
||||||
@defintmethods[pixel-height]
|
|
||||||
|
|
||||||
@defrealmethods[pos-top]
|
|
||||||
@defrealmethods[pos-left]
|
|
||||||
@defrealmethods[pos-width]
|
|
||||||
@defrealmethods[pos-height]
|
|
||||||
|
|
||||||
@defmethods[color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
@defmethods[background-color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
|
|
||||||
@defmethods[background-position-x
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'left 'center 'right))]
|
|
||||||
@defmethods[background-position-y
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'left 'center 'right))]
|
|
||||||
|
|
||||||
@defmethods[letter-spacing
|
|
||||||
(or/c css-length? (one-of/c 'normal))]
|
|
||||||
|
|
||||||
@defmethods[vertical-align
|
|
||||||
(one-of/c 'baseline 'sub 'super 'top 'middle
|
|
||||||
'bottom 'text-top 'text-bottom)]
|
|
||||||
@defmethods[text-indent
|
|
||||||
(or/c css-length? css-percentage?)]
|
|
||||||
|
|
||||||
@defmethods[line-height
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'normal))]
|
|
||||||
|
|
||||||
@defmethods[margin-top
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
@defmethods[margin-bottom
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
@defmethods[margin-left
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
@defmethods[margin-right
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
|
|
||||||
@defmethods[padding-top
|
|
||||||
(or/c css-length? css-percentage?)]
|
|
||||||
@defmethods[padding-bottom
|
|
||||||
(or/c css-length? css-percentage?)]
|
|
||||||
@defmethods[padding-left
|
|
||||||
(or/c css-length? css-percentage?)]
|
|
||||||
@defmethods[padding-right
|
|
||||||
(or/c css-length? css-percentage?)]
|
|
||||||
|
|
||||||
@defmethods[border-top-color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
@defmethods[border-bottom-color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
@defmethods[border-left-color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
@defmethods[border-right-color
|
|
||||||
(or/c symbol? string?)]
|
|
||||||
|
|
||||||
@defmethods[border-top-width
|
|
||||||
(or/c css-length?
|
|
||||||
(one-of/c 'medium 'thin 'thick))]
|
|
||||||
@defmethods[border-bottom-width
|
|
||||||
(or/c css-length?
|
|
||||||
(one-of/c 'medium 'thin 'thick))]
|
|
||||||
@defmethods[border-left-width
|
|
||||||
(or/c css-length?
|
|
||||||
(one-of/c 'medium 'thin 'thick))]
|
|
||||||
@defmethods[border-right-width
|
|
||||||
(or/c css-length?
|
|
||||||
(one-of/c 'medium 'thin 'thick))]
|
|
||||||
|
|
||||||
@defmethods[width
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
@defmethods[height
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
|
|
||||||
@defmethods[top
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
@defmethods[left
|
|
||||||
(or/c css-length? css-percentage?
|
|
||||||
(one-of/c 'auto))]
|
|
||||||
|
|
||||||
@defmethods[z-index
|
|
||||||
(or/c exact-integer? (one-of/c 'auto))]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
167
collects/mysterx/scribblings/methprop.scrbl
Normal file
167
collects/mysterx/scribblings/methprop.scrbl
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
#lang scribble/doc
|
||||||
|
@(require "common.ss")
|
||||||
|
|
||||||
|
@title[#:tag "methprop"]{COM Methods and Properties}
|
||||||
|
|
||||||
|
MysterX allows scripting of most COM components from Scheme. A COM
|
||||||
|
component can be scripted in MysterX if it supports OLE Automation
|
||||||
|
via the @tt{IDispatch} interface, and if it publishes type
|
||||||
|
information using the @tt{ITypeInfo} interface.
|
||||||
|
|
||||||
|
@defproc[(com-all-coclasses) (listof string?)]{
|
||||||
|
|
||||||
|
Returns a list of strings for all COM classes
|
||||||
|
registered on a system.}
|
||||||
|
|
||||||
|
@defproc[(com-all-controls) (listof string?)]{
|
||||||
|
|
||||||
|
Returns a list of strings for all COM classes
|
||||||
|
registered on a system that have the @scheme["Control"]
|
||||||
|
subkey.}
|
||||||
|
|
||||||
|
@deftogether[(
|
||||||
|
@defproc[(cocreate-instance-from-coclass [coclass string?]
|
||||||
|
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
||||||
|
com-object?]
|
||||||
|
@defproc[(cci/coclass [coclass string?]
|
||||||
|
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
||||||
|
com-object?]
|
||||||
|
)]{
|
||||||
|
|
||||||
|
Returns an instance of @scheme[coclass]. This is useful for COM
|
||||||
|
classes without a visual representation, or when a visual
|
||||||
|
representation is not needed.
|
||||||
|
|
||||||
|
The optional argument @scheme[where] indicates a for running the
|
||||||
|
instance, and may be @scheme['local], @scheme['remote], or a string
|
||||||
|
indicating a machine name. See @secref["remote"] for more
|
||||||
|
information.}
|
||||||
|
|
||||||
|
@deftogether[(
|
||||||
|
@defproc[(cocreate-instance-from-progid [progid string?]
|
||||||
|
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
||||||
|
com-object?]
|
||||||
|
@defproc[(cci/progid [progid string?]
|
||||||
|
[where (or/c (one-of/c 'local 'remote) string?) 'local])
|
||||||
|
com-object?]
|
||||||
|
)]{
|
||||||
|
|
||||||
|
Like @scheme[cocreate-instance-from-coclass], but using a ProgID.}
|
||||||
|
|
||||||
|
|
||||||
|
@defproc[(coclass [obj com-object?]) string?]{
|
||||||
|
|
||||||
|
Returns a string that is the name of the COM class instantiated by
|
||||||
|
@scheme[obj], or raises an error if the COM class is not known.}
|
||||||
|
|
||||||
|
@defproc[(progid [obj com-object?]) string?]{
|
||||||
|
|
||||||
|
Returns a string that is the name of the ProgID instantiated by
|
||||||
|
@scheme[obj], or raises an error if the COM class is not known.}
|
||||||
|
|
||||||
|
@defproc[(set-coclass! [obj com-object?] [coclass string?]) void?]{
|
||||||
|
|
||||||
|
Sets the COM class for @scheme[obj] to @scheme[coclass]. This is
|
||||||
|
useful when MysterX COM event-handling procedures can obtain only
|
||||||
|
ambiguous information about the object's COM class.}
|
||||||
|
|
||||||
|
@defproc[(set-coclass-from-progid! [obj com-object?] [progid string?]) void?]{
|
||||||
|
|
||||||
|
Like @scheme[set-coclass!], but using a ProgID.}
|
||||||
|
|
||||||
|
@defproc[(com-methods [obj/type (or/c com-object? com-type?)])
|
||||||
|
(listof string?)]{
|
||||||
|
|
||||||
|
Returns a list of strings indicating the names of methods on
|
||||||
|
@scheme[obj/type].}
|
||||||
|
|
||||||
|
@defproc[(com-method-type [obj/type (or/c com-object? com-type?)]
|
||||||
|
[method-name string?])
|
||||||
|
(listof symbol?)]{
|
||||||
|
|
||||||
|
Returns a list of symbols indicating the type of the specified
|
||||||
|
method in @scheme[obj/type]. See @secref["com-types"] for
|
||||||
|
information on the symbols.}
|
||||||
|
|
||||||
|
@defproc[(com-invoke [obj com-object?] [method-name string?] [v any/c])
|
||||||
|
any/c]{
|
||||||
|
|
||||||
|
Invokes @scheme[method-name] on @scheme[obj] with @scheme[v]s as the
|
||||||
|
arguments. The special value @scheme[com-omit] may be used for
|
||||||
|
optional arguments, which useful when values are supplied for
|
||||||
|
arguments after the omitted argument(s).}
|
||||||
|
|
||||||
|
@defproc[(com-get-properties [obj/type (or/c com-object? com-type?)])
|
||||||
|
(listof string?)]{
|
||||||
|
|
||||||
|
Returns a list of strings indicating the names of readable
|
||||||
|
properties in @scheme[obj/type].}
|
||||||
|
|
||||||
|
@defproc[(com-get-property-type [obj/type (or/c com-object? com-type?)]
|
||||||
|
[property-name string?])
|
||||||
|
(listof symbol?)]{
|
||||||
|
|
||||||
|
Returns a list of symbols indicating the type of the specified
|
||||||
|
property in @scheme[obj/type]. See @secref["com-types"] for
|
||||||
|
information on the symbols.}
|
||||||
|
|
||||||
|
@defproc[(com-get-property [obj com-object?] [property string?] ...+)
|
||||||
|
any/c]{
|
||||||
|
|
||||||
|
Returns the value of the final property by following the indicated
|
||||||
|
path of @scheme[property]s, where each intermediate property is a
|
||||||
|
COM object.}
|
||||||
|
|
||||||
|
@defproc[(com-set-properties [obj/type (or/c com-object? com-type?)])
|
||||||
|
(listof string?)]{
|
||||||
|
|
||||||
|
Returns a list of strings indicating the names of writeable
|
||||||
|
properties in @scheme[obj/type].}
|
||||||
|
|
||||||
|
@defproc[(com-set-property-type [obj/type (or/c com-object? com-type?)]
|
||||||
|
[property-name strig?])
|
||||||
|
(listof symbol?)]{
|
||||||
|
|
||||||
|
Returns a list of symbols indicating the type of the specified
|
||||||
|
property in @scheme[obj/type]. See @secref["com-types"] for
|
||||||
|
information on the symbols.}
|
||||||
|
|
||||||
|
@defproc[(com-set-property! [obj com-object?]
|
||||||
|
[string? property] ...+
|
||||||
|
[v any/c])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Sets the value of the final property in @scheme[obj] to @scheme[v]
|
||||||
|
by following the @scheme[property]s, where the value of each
|
||||||
|
intermediate property is a COM object.}
|
||||||
|
|
||||||
|
@defproc[(com-help [obj/type (or/c com-object? com-type?)]
|
||||||
|
[topic string? ""])
|
||||||
|
void?]{
|
||||||
|
|
||||||
|
Starts the Window Help system with help about the COM object or COM
|
||||||
|
type. The optional @scheme[topic] is typically a method or property
|
||||||
|
name.}
|
||||||
|
|
||||||
|
@defproc[(com-object-eq? [obj1 com-object?] [obj2 com-object?])
|
||||||
|
boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if the two COM objects are the same,
|
||||||
|
@scheme[#f] otherwise.}
|
||||||
|
|
||||||
|
@defproc[(com-object? [obj com-object?]) boolean?]{
|
||||||
|
|
||||||
|
Returns @scheme[#t] if the argument is a COM object, @scheme[#f]
|
||||||
|
otherwise.}
|
||||||
|
|
||||||
|
@defproc[(com-add-ref [obj com-object?]) void?]{
|
||||||
|
|
||||||
|
Increments the reference count for @scheme[obj].
|
||||||
|
This procedure should only be called when system-level
|
||||||
|
errors occur due to a mismanaged COM object. Ordinarily,
|
||||||
|
MysterX handles all COM reference-counting automatically.}
|
||||||
|
|
||||||
|
@defproc[(com-ref-count [obj com-object?]) exact-nonnegative-integer?]{
|
||||||
|
|
||||||
|
Returns a number indicating the current reference count
|
||||||
|
for a COM object.}
|
|
@ -4,25 +4,17 @@
|
||||||
@title{@bold{MysterX}: Using Windows COM Objects in Scheme}
|
@title{@bold{MysterX}: Using Windows COM Objects in Scheme}
|
||||||
|
|
||||||
@bold{MysterX} is a toolkit for building Windows applications from
|
@bold{MysterX} is a toolkit for building Windows applications from
|
||||||
ActiveX and COM components, using Scheme as glue code. Dynamic HTML
|
@as-index{ActiveX} and COM components, using Scheme as glue code.
|
||||||
is used for component presentation and event-handling. MysterX
|
Dynamic HTML (DHTML) is used for component presentation and
|
||||||
requires Internet Explorer (IE) 4 or later to be installed.
|
event-handling.
|
||||||
Distributed COM (DCOM) for your version of Windows is also required.
|
|
||||||
Recent versions of Windows come with DCOM; DCOM packages for Windows
|
|
||||||
95 and 98 are made available separately.
|
|
||||||
|
|
||||||
@defmodule[mysterx]
|
@defmodule[mysterx]
|
||||||
|
|
||||||
@table-of-contents[]
|
@table-of-contents[]
|
||||||
|
|
||||||
@include-section["overview.scrbl"]
|
@include-section["overview.scrbl"]
|
||||||
@include-section["version.scrbl"]
|
|
||||||
@include-section["browsers.scrbl"]
|
|
||||||
@include-section["documents.scrbl"]
|
|
||||||
@include-section["html-events.scrbl"]
|
|
||||||
@include-section["com-types.scrbl"]
|
|
||||||
@include-section["com.scrbl"]
|
@include-section["com.scrbl"]
|
||||||
@include-section["dcom.scrbl"]
|
@include-section["activex.scrbl"]
|
||||||
@include-section["com-events.scrbl"]
|
@include-section["version.scrbl"]
|
||||||
@include-section["types.scrbl"]
|
|
||||||
@include-section["html.scrbl"]
|
@index-section[]
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
@section{Installation}
|
@section{Installation}
|
||||||
|
|
||||||
|
MysterX requires Internet Explorer (IE) 4 or later to be installed.
|
||||||
|
Distributed COM (DCOM) for your version of Windows is also required.
|
||||||
|
Recent versions of Windows come with DCOM; DCOM packages for Windows
|
||||||
|
95 and 98 are made available separately.
|
||||||
|
|
||||||
Two Windows DLLs support low-level operations in MysterX:
|
Two Windows DLLs support low-level operations in MysterX:
|
||||||
@filepath{myspage.dll} and @filepath{myssink.dll}. Both are installed
|
@filepath{myspage.dll} and @filepath{myssink.dll}. Both are installed
|
||||||
in the registry (using @exec{regsvr32.exe}) when Setup PLT runs the
|
in the registry (using @exec{regsvr32.exe}) when Setup PLT runs the
|
||||||
|
@ -40,6 +45,8 @@ little setup program (as an executable) in your distribution:
|
||||||
(system* regsvr32 (path->string myssink-dll)))
|
(system* regsvr32 (path->string myssink-dll)))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
@section{Running a Demo}
|
@section{Running a Demo}
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
@ -52,6 +59,7 @@ The demo requires the MSCal Calendar control. The calendar control is
|
||||||
normally installed with Microsoft Office, but it can also be
|
normally installed with Microsoft Office, but it can also be
|
||||||
downloaded from elsewhere; look for @filepath{mscal.ocx}.
|
downloaded from elsewhere; look for @filepath{mscal.ocx}.
|
||||||
|
|
||||||
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
@section{Loading}
|
@section{Loading}
|
||||||
|
|
||||||
|
@ -72,3 +80,7 @@ Several MysterX procedures take HTML strings as input. The
|
||||||
@schememodname[xml] library provides procedures that convert Scheme
|
@schememodname[xml] library provides procedures that convert Scheme
|
||||||
syntax into XML strings. You may find using these procedures useful
|
syntax into XML strings. You may find using these procedures useful
|
||||||
in creating HTML strings for use by MysterX.
|
in creating HTML strings for use by MysterX.
|
||||||
|
|
||||||
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@include-section["dcom.scrbl"]
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
#lang scribble/doc
|
|
||||||
@(require "common.ss")
|
|
||||||
|
|
||||||
@title[#:tag "types"]{MysterX Types}
|
|
||||||
|
|
||||||
There are a few special types that appear in the
|
|
||||||
types of COM component methods and properties.
|
|
||||||
We describe those types and, in some cases, operations
|
|
||||||
involving those types.
|
|
||||||
|
|
||||||
@defproc[(com-currency? [v any/c]) boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is a COM currency value,
|
|
||||||
@scheme[#f] otherwise.}
|
|
||||||
|
|
||||||
@defproc[(com-currency->number [curr com-currency?]) real?]{
|
|
||||||
|
|
||||||
Returns a number for @scheme[curr].}
|
|
||||||
|
|
||||||
@defproc[(number->com-currency [n real?]) com-currency?]{
|
|
||||||
|
|
||||||
Converts a number to a COM currency value. A currency value is
|
|
||||||
repsented with a 64-bit two's-complement integer, though @scheme[n]
|
|
||||||
may contain decimal digits. If @scheme[n] is too large, an
|
|
||||||
exception is raised.}
|
|
||||||
|
|
||||||
@defproc[(com-date? [v any/c]) boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is a COM date value, @scheme[#f]
|
|
||||||
otherwise.}
|
|
||||||
|
|
||||||
@defproc[(com-date->date [d com-date?]) date?]{
|
|
||||||
|
|
||||||
Converts a COM date to an instance of the @scheme[date] structure
|
|
||||||
type. In the result, the @scheme[dst?] field is always @scheme[#f],
|
|
||||||
and the @scheme[time-zone-offset] field is @scheme[0].}
|
|
||||||
|
|
||||||
@defproc[(date->com-date [d date?]) com-date?]{
|
|
||||||
|
|
||||||
Converts a @scheme[date] instance to a COM date value.}
|
|
||||||
|
|
||||||
@defproc[(com-scode? [v any/c]) boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is a COM scode value, @scheme[#f]
|
|
||||||
otherwise.}
|
|
||||||
|
|
||||||
@defproc[(com-scode->number [sc com-scode?]) integer?]{
|
|
||||||
|
|
||||||
Converts a COM scode value to an integer.}
|
|
||||||
|
|
||||||
@defproc[(number->com-scode [n integer?]) com-scode?]{
|
|
||||||
|
|
||||||
Converts a number to a COM scode value. The number must be
|
|
||||||
representable as a 32-bit two's-complement number, otherwise an
|
|
||||||
exception is raised.}
|
|
||||||
|
|
||||||
@defproc[(com-iunknown? [v any/c]) boolean?])
|
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is a COM IUnknown value,
|
|
||||||
@scheme[#f] otherwise.}
|
|
||||||
|
|
||||||
@defproc[(mx-any? [v any/c]) boolean?]{
|
|
||||||
|
|
||||||
Returns @scheme[#t] if @scheme[v] is a character, real number,
|
|
||||||
string, boolean, COM currency (as in @scheme[com-currency?]), COM
|
|
||||||
date (as in @scheme[com-date?]), COM scode value (as in
|
|
||||||
@scheme[com-scode?]), COM IUnknown value (as in
|
|
||||||
@scheme[com-iunknown?], or COM object (as in @scheme[com-object?]).}
|
|
Loading…
Reference in New Issue
Block a user