[plt-scheme] enhancing the drscheme editor & GUIBuilder
Corey Sweeney wrote:
>I decided to try to enhance GUIBuilder a little bit today, but am
>having some trouble figuring out how it works.
>
>My first objective was to find how to add my own item to the special
>menu, that would just do something simple like insert a text string or
>so, so that i'd be able to start probing the environment for how to
>construct my new idea.
>
>I've found it adds the "Insert GUI" to the special menu via
>(make-object menu-item% "Insert GUI" (get-special-menu)...)
>
>but trying to make my own insertion object attempt dosn't work:
>
>(make-object menu-item% "Insert hoopty" (get-special-menu) (lambda (a
>b) "hoopty"))
>
>reports unknown "get-special-menu". I looked it up in the help and
>help said i needed to write it like this:
>
>(send a-drscheme:unit:frame get-special-menu)
>
>but when i try it, it reports "a-drscheme:unit:frame not found".
>
The "a-drscheme:unit:frame" is an example of possible variable in your
own program.
That (get-special-menu) works in
(make-object menu-item% "Insert GUI" (get-special-menu)...)
is due to the fact that the expression occurs inside the definition
of a sub class of drs:frame%:
(class drs:frame%
(inherit get-special-menu get-edit-target-object)
...
(make-object menu-item% "Insert GUI" (get-special-menu)...)
...)
>so since we don't have apropos, or tab completion in drscheme,
>
We have the HelpDesk.
But note also that "Search in Files" in the "File" menu provides an easy way
to search say the "collects" directory for occurrences of get-special-menu.
>i typed
>(interact-environment) in hopes to grep the namespace. but i got back
>#<namespace> which i didn't know how to grep.
>
>
Search for namespace-mapped-symbols for a function to convert the
#<namespace>
into somthing printable (but searching the HelpDesk is always better).
>now the man page for get-special-menu dosn't mention needing any
>required .ss files, so i loaded tool.ss and clicked run before typing
>them in, so all the guibuilder libs would be loaded in the interactive
>environment. I also whipped the commands into guilbuider.ss then
>clicked run, and it did not seem to update the menu at all.
>
>So i'm stumped on this. Any help?
>
>
The get-special-menu is a method an object of class drs:frame% . You
thus need to
get the current frame DrScheme is using.
>P.S.S Anyone want a gmail account? I have some invitations
>
>
I'd like one.
--
Jens Axel Søgaard