On 6 October 2015 at 01:45, Aman <
amang...@gmail.com> wrote:
>
> Thanks Laurent and Paolo. When you say (send a-text insert string), how are you getting a-text ?
> What I wanted was not to design a new editor window, but to modify or 'send' some command to current editor (the default one when we launch DrRacket) to clear some content or scroll down to hide the content, but I am not able to find a way to get handle for editor%, text% or anything else that can be helpful while executing 'send'
Yeah, a very good question, that's why I asked Laurent for his "quick
attempt" :-).
The two ways I can imagine are writing a plugin or modifying DrRacket,
and I expect the latter to be easier; my only experience is modifying
a DrRacket plugin, and I don't think this is quick, but it's possible.
For that, I think you want to look at
drracket:get/extend:extend-interactions-text. To be in the context to
do that, see
http://docs.racket-lang.org/tools/implementing-tools.html
and the examples shown there using
drracket:get/extend:extend-definitions-text.
Below's I'll give an outline anyway of what I actually did, in case
it's helpful — though the docs are probably better.
==
I've been hacking a DrRacket plugin (the handin client), where I use
something more complex because I assumed I only had a editor% (so I
used insert-port). My call is in
https://github.com/racket/handin/pull/27/files#diff-cf0f873382d5f6c351cee18d851376c3R734;
the code around it does a number of potentially useful things.
The starting point is the call drracket:get/extend:extend-unit-frame,
in the context of
(define tool@
(unit
(import drracket:tool^)
(export drracket:tool-exports^)
...
drracket:get/extend:extend-unit-frame subclasses the unit-frame
DrRacket component, and inside it you can call get-definitions-text
and get-interactions-text to get access to the two text%.
For that, refer to the docs extensively, starting from
http://docs.racket-lang.org/tools/, its index, and the introduction
into how to do a plugin.
By doing that, I just found out about
drracket:get/extend:get-interactions-text, which allows you to
subclass the interactions-text directly.
While this is a lot, I've found I managed to get something done
without needing to understand every detail, also thanks to Racket
syntax-check. It's sad it doesn't understand units as well as the
rest.
(OTOH, I'm scared that I'm writing code without understanding every
single line around it. I usually never do that, but I'm new at
Racket).
Cheers,
Paolo
> You received this message because you are subscribed to a topic in the Google Groups "Racket Users" group.
> To unsubscribe from this topic, visit
https://groups.google.com/d/topic/racket-users/_XWopH-iMNw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
racket-users...@googlegroups.com.
--
Paolo G. Giarrusso - Ph.D. Student, Tübingen University
http://ps.informatik.uni-tuebingen.de/team/giarrusso/
--
Paolo G. Giarrusso - Ph.D. Student, Tübingen University
http://ps.informatik.uni-tuebingen.de/team/giarrusso/