{"size": 1759, "ext": "scrbl", "max_stars_repo_path": "gui-doc/scribblings/gui/dynamic.scrbl", "max_stars_repo_name": "jjsimpso/gui", "max_stars_repo_stars_event_min_datetime": "2015-03-17T22:11:52.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T15:09:34.000Z", "max_issues_repo_path": "gui-doc/scribblings/gui/dynamic.scrbl", "max_issues_repo_name": "jjsimpso/gui", "max_issues_repo_issues_event_min_datetime": "2015-01-09T15:53:25.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T16:21:29.000Z", "max_forks_repo_path": "gui-doc/scribblings/gui/dynamic.scrbl", "max_forks_repo_name": "jjsimpso/gui", "max_forks_repo_forks_event_min_datetime": "2015-01-08T13:03:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-26T21:49:09.000Z"}
{"max_stars_count": 65, "max_issues_count": 231, "max_forks_count": 89, "avg_line_length": 35.8979591837, "max_line_length": 73, "alphanum_fraction": 0.7674815236}
#lang scribble/doc
@(require "common.rkt" (for-label racket/gui/dynamic))

@title{Dynamic Loading}

@defmodule[racket/gui/dynamic]{The @racketmodname[racket/gui/dynamic]
library provides functions for dynamically accessing the
@racketmodname[racket/gui/base] library, instead of directly requiring
@racketmodname[racket/gui] or @racketmodname[racket/gui/base].}

@defproc[(gui-available?) boolean?]{

Returns @racket[#t] if dynamic access to the GUI bindings is
available. The bindings are available if
@racketmodname[racket/gui/base] has been loaded, instantiated, and
attached to the namespace in which @racketmodname[racket/gui/dynamic] was
instantiated.}


@defproc[(gui-dynamic-require [sym symbol?]) any]{

Like @racket[dynamic-require], but specifically to access exports of
@racketmodname[racket/gui/base], and only when @racket[(gui-available?)]
returns true.

The @racket[gui-dynamic-require] function is intended primarily for
use under a @racket[(gui-available?)] conditional. It can also be used
as a shorthand for @racket[dynamic-require] with
@racket['racket/gui/base], but only after ensuring that the bindings
are available. One way to make @racketmodname[racket/gui/base]
bindings available, so that @racket[(gui-available?)] returns true, is
through @racket[dynamic-require]:

@racketblock[
(dynamic-require 'racket/gui/base #f)
]

Unlike @racket[require], using @racket[dynamic-require] delays the
instantiation of @racketmodname[racket/gui/base] until the run-time
call of @racket[dynamic-require]. With @racketmodname[racket/gui/base]
so declared, @racket[gui-dynamic-require] can be used to access
bindings:

@racketblock[
(define window (new (gui-dynamic-require 'frame%)
                    [label "Frame"]))
(send window show #t)
]}
