[racket] how to tell, or trigger, on when an object is ready in tool on on startup

From: Stephen De Gabrielle (stephen.degabrielle at acm.org)
Date: Sat Jul 31 08:14:57 EDT 2010

Thanks for the advice. I'll see what I can do.

Cheers,
Stephen

On Friday, July 30, 2010, Robby Findler <robby at eecs.northwestern.edu> wrote:
> Sorry for the long delay in replying. There isn't a good way to do
> what you want (I'd hoped to find time to add one which is the reason
> for the delay, but that's looking unlikely I'm sorry to say).
>
> The best thing is probably to queue a low-priority callback from the
> place where you're calling reload-my-tabs-from-file and have that do
> the work. That way, you know that the objects will be completely
> initialized.
>
> You might also try calling that after you call super-init in a frame%
> mixin, but you might get the same problems in that case.
>
> Really, the best thing would be to change the code at the end of
> drracket/private/main.rkt so that instead of calling make-basic it
> called your function (perhaps when some preference was set).
>
> hth,
> Robby
>
> On Tue, Jul 27, 2010 at 2:54 AM, Stephen De Gabrielle
> <stephen.degabrielle at acm.org> wrote:
>> Hi,
>>
>> I'm working on the tools facilities to build extensions for DrRacket,
>> and I'm having some trouble;
>>
>> I think I'm getting the ''send: target is not an object: #<undefined>
>> for method: is-shown?
>> '' error on startup because the frame, tabs or text% is not yet
>> finished starting up.
>>
>> I'd appreciate any help on how to run my method when DrRacket is ready?
>>
>> Cheers,
>>
>> Stephen
>>
>>
>> --
>> send: target is not an object: #<undefined> for method: is-shown?
>>
>>  === context ===
>> /Applications/Racket
>> v5.0/collects/racket/private/class-internal.rkt:4543:0: obj-error
>> /Applications/Racket
>> v5.0/collects/racket/private/class-internal.rkt:3786:0:
>> find-method/who
>> /Applications/Racket
>> v5.0/collects/gui-debugger/debug-tool.rkt:1404:10:
>> check-current-language-for-debugger method in
>> ...ugger/debug-tool.rkt:1048:8
>> /Applications/Racket
>> v5.0/collects/gui-debugger/debug-tool.rkt:1393:10: on-tab-change
>> method in ...ugger/debug-tool.rkt:1048:8
>> /Applications/Racket v5.0/collects/drracket/syncheck.rkt:1027:8:
>> on-tab-change method in ...rracket/syncheck.rkt:1019:6
>> /Applications/Racket
>> v5.0/collects/drracket/private/module-language-tools.rkt:58:6:
>> on-tab-change method in ...e-language-tools.rkt:49:4
>> /Applications/Racket v5.0/collects/drracket/private/tracing.rkt:168:6:
>> on-tab-change method in .../private/tracing.rkt:163:4
>> /Applications/Racket v5.0/collects/drracket/private/debug.rkt:1580:6:
>> on-tab-change method in ...et/private/debug.rkt:1506:4
>> /Applications/Racket v5.0/collects/drracket/private/unit.rkt:2847:8:
>> change-to-tab method in ...ket/private/unit.rkt:1419:6
>> /Applications/Racket v5.0/collects/drracket/private/unit.rkt:2817:10: core
>> /Applications/Racket v5.0/collects/racket/private/map.rkt:45:11: for-each
>> /Applications/Racket v5.0/collects/cosmonaut/tabs.rkt:26:6
>> /Applications/Racket
>> v5.0/collects/racket/private/class-internal.rkt:3596:0:
>> continue-make-super
>> /Applications/Racket v5.0/collects/gui-debugger/debug-tool.rkt:1048:8
>> /Applications/Racket
>> v5.0/collects/racket/private/class-internal.rkt:3596:0:
>> continue-make-super
>> /Applications/Racket v5.0/collects/macro-debugger/tool.rkt:118:6
>> ...
>>
>>
>> --
>>
>> #lang racket/gui
>> (require racket/class
>>         framework
>>         racket/unit
>>         racket/path
>>         drracket/tool)
>>
>> (preferences:set-default
>>  'ProjectManager:tabs "/Users/spdegabrielle/tabs.sp"
>>  ; (path->string (build-path (find-system-path 'home-dir) "tabs.sp"))
>>  string?)
>>
>> (provide tool@)
>> (define tool@
>>  (unit
>>    (import drracket:tool^)
>>    (export drracket:tool-exports^)
>>    (define (phase1) (void))
>>    (define (phase2) (void))
>>    ;
>>    ;    (define tab-mixin
>>    ;      (mixin ()()
>>    ;        (super-new)
>>    ;        ))
>>    (define (save/load-tabs-mixin super%)
>>      (class super%
>>        (inherit open-in-new-tab get-tabs)
>>
>>        ;        ;; 'ProjectManager:tabs ; path to tabs file
>>        (field (saved-tabs-file (string->path "/Users/spdegabrielle/tabs.sp")))
>>                                 ;(preferences:get 'ProjectManager:tabs))))
>>        ;
>>        ;; save-tabs : out-file tabs -> void
>>        (define/private (save-tabs-file out-file tabs)
>>          (call-with-output-file out-file; saved-tabs-file-path
>>            (lambda (i) (wri> _________________________________________________
>>  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.