[racket] affing a panel to DrRacket

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jul 2 07:22:25 EDT 2010

You want to override the make-root-area-container method to create
your panel. See here:

http://docs.racket-lang.org/framework/Frame.html?q=frame%3Abasic#%28meth._%28%28%28lib._framework/main..rkt%29._frame~3abasic~3c~25~3e%29._make-root-area-container%29%29

(and ask again if that's not enough of a hint; sorry for the clue
dropping, I promise that eventually I make a little example if you
don't beat me to it.)

Robby

On Thu, Jul 1, 2010 at 9:42 AM, Stephen De Gabrielle
<spdegabrielle at gmail.com> wrote:
> it's lives, but I'm still  a little confused on how I set where it sits in
> the layout, and how to make it dragable - the class is not enough.  I
> appreciate the help - I'm having a bad run at making sense of the
> documentation.
>
> the relevant bit;
> [...]
>     (define (tabs-mixin super%)
>       (class super%
>         (define text (new text%))
>         (super-new)
>         (let* ((area-container (send this get-area-container))
>                (test-panel (new panel:horizontal-dragable% (parent
> area-container)))
>                (text (new text%))
>                (ed (new editor-canvas% (parent test-panel))))
>           (send ed set-editor text)
>           #;(send area-container add-child test-panel))  ;;; I need a parent
> to instantiate a panel.
>         ))
> [...]
>
> As you can see I'm also curious about the nature of the add-child method,
> given that the panel is added at instantiation, and a parent is required.
>
> Thanks again for your help.
> ,
> Stephen
>
> Full file;
>
> #lang racket/base
> (require mred
>          racket/class
>          scheme/file
>          scheme/contract
>          framework/framework
>          framework
>          racket/unit
>          drracket/tool-lib
>          drscheme/tool
>          )
>
> (provide tool@)
>
> (define tool@
>   (unit
>     (import drracket:tool^)
>     (export drracket:tool-exports^)
>     (define (phase1) (void))
>     (define (phase2) (void))
>
> (define (tabs-mixin super%)
>       (class super%
>         ; frame:basic<%>
>         ; frame:basic-mixin: do not add children directly to a frame:basic
> (unless using make-root-area-container)
>         ; use the get-area-contaner method instead
>         (define text (new text%))
>
>         (inherit get-current-tab get-menu-bar get-button-panel
> register-toolbar-button)
>         (super-new)
>
>         (let* ((area-container (send this get-area-container))
>                (test-panel (new panel:horizontal-dragable% (parent
> area-container)))
>                (text (new text%))
>                (ed (new editor-canvas% (parent test-panel))))
>           (send ed set-editor text)
>           #;(send area-container add-child test-panel))
>         ))
>
>
>     (drracket:get/extend:extend-unit-frame tabs-mixin)
>     ))
>
> ;; info file
> #lang setup/infotab
>
> (define name "Cosmonaut")
> (define version "0.1")
> (define release-notes '("for Racket 5"))
> (define blurb '("Cosmonaut lets you explore the PLaneT package repository
> from within DrScheme."))
>
> (define doc.txt "doc.txt")
> (define homepage "http://sp.degabrielle.name/cosmonaut")
>
>
> (define drracket-tools '(("cosmonaut.rkt")
>                          ;("fossil.rkt")
>                          ;("tabs.rkt")
>                          ))
>
> (define drracket-tool-names '("Cosmonaut"
>                               ;"Fossil"
>                               ;"Tabs"
>                               ))
>
> ;(define drracket-tool-icons (list (list "cosmonaut.png" "fossil.png"
> "projectmgr.png")))
> (define drracket-tool-urls  '(("http://sp.degabrielle.name/cosmonaut")
>                               ;("http://sp.degabrielle.name/Fossil")
>                               ;("http://sp.degabrielle.name/Tabs")
>                               ))
>
>
>
>
>
>
>
>
>
> On Wed, Jun 30, 2010 at 5:02 PM, Robby Findler <robby at eecs.northwestern.edu>
> wrote:
>>
>> You want to create a tool, add in a frame-mixin (both via the tools
>> interface), and then use the frame:basic<%> mechanism for adding
>> panels to the frame.
>>
>> If that's not enough to get you started, I'll write up a little
>> example tool that does it.
>>
>> Robby
>>
>> On Wed, Jun 30, 2010 at 8:30 AM, Stephen De Gabrielle
>> <spdegabrielle at gmail.com> wrote:
>> > Hi,
>> >
>> > Please forgive my ignorance,  I'm trying to work out how to add a panel
>> > (like program contour) to DrRacket.
>> >
>> > Does anyone know the correct method, or can point me to source code, or
>> > the
>> > right bit of the documentation?
>> >
>> > Cheers,
>> >
>> > Stephen
>> >
>> > _________________________________________________
>> >  For list-related administrative tasks:
>> >  http://lists.racket-lang.org/listinfo/users
>> >
>
>
>
> --
>
> --
> Stephen De Gabrielle
> stephen.degabrielle at acm.org
> Telephone +44 (0)20 85670911
> Mobile        +44 (0)79 85189045
> http://www.degabrielle.name/stephen
>
>

Posted on the users mailing list.