[plt-scheme] enhancing the drscheme editor & GUIBuilder
get-special-menu is a method, so you need an appropriate object to call
it with. The schema from the manual:
(send a-drscheme:unit:frame get-special-menu)
is just showing the syntax assuming that the variable
a-drscheme:unit:frame was bound to an appropriate object.
As it turns out, the only way to get ahold of such an object is to be
running inside drscheme, as a tool. So, to add your menu item, you
could just add the hoopty line below right next to the current "Insert
GUI" line in plt/collects/guibuilder/tool.ss
In general, you probably need to read up on classes and object systems
somewhere. Java's class systems has lots of literature and is similar
in spirit to ours (they aren't the same, but the basics are very
similar and a good understanding of Java will carry over). You can also
try studying the mzscheme manual's class.ss section.
As far as GUI Builder's doing it's thing goes, you will want to read up
on snips and editors in the mred manual. There's a lot of material to
cover, but there's no magic, just a good number of interfaces to read
about.
Robby
At Mon, 13 Sep 2004 11:24:38 -0500, Corey Sweeney wrote:
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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".
>
> so since we don't have apropos, or tab completion in drscheme, i typed
> (interact-environment) in hopes to grep the namespace. but i got back
> #<namespace> which i didn't know how to grep.
>
> 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?
>
>
>
>
>
> My other objective was to figure out how GUIBuilder actually does it's
> thing. Originally i had thought GUIBuilder was cheating was rewriting
> drscheme chunks and just linking them in, but then i found out
> yesterday that plt has support for extending the external
> represenations. Is this How GUIBuilder is adding the display objects
> to the editor? All I could find was a "insert-format-handler" in
> guibuilder.ss, but from the calls description, it seemed more like a
> mime type for files, then a display type for objects.
>
>
>
> Corey
>
> P.S. Is anyone else having problems cutting from drscheme and pasting
> to another window (a email client window, for example) on v208
> linux/gnome?
>
> P.S.S Anyone want a gmail account? I have some invitations