I'm tooling around with a current-user-directory and hierarchical-list% in
#lang racket/gui and it seems to be working adding folders works ok, but
when I delete a group of folders I get the following error;

hierarchical-list-compound-item::delete-item: item not found:
#(struct:object:hierarchical-list-item% ...)
. sequence-contract-violation: negative: method delete cannot be called,
except in states (unlocked), args 0 3

I'm guessing the  '(map (λ (i) (send this delete-item i)) (send this
get-items))' is happening too fast? I'm going to try switching to deleting
one at a time.

More importantly, if anyone is familiar with threads and can spare a moment
I'd appreciate a quick code review.

The final goal is to have make a Dr racket tool/plugin that shows the
current directory, functions/methods/classes like {visual-studio xcode atom
emacs vim eclipse netbeans etc.}. (Working on the directory control helps
me get my head around hierarchical-list%, and I can make it into a small

Kind regards,


#lang racket/gui
(require framework mrlib/hierlist)
(define window (new frame% [label "directory-hlist"] [width 600] [height
(define directory-hlist%
  (class hierarchical-list%
    (inherit get-dc refresh)
    (init-field [directory-path (current-directory-for-user)])
    (define (dir-name-from-path path)
      (define-values (base name must-be-dir?) (split-path path))
    (define/private (populate-d-hlist)
       (λ (path)
         (if (directory-exists? path)
             (send (send (send this new-list) get-editor)
                   insert (path->string (dir-name-from-path path)))
             (send (send (send this new-item) get-editor)
                   insert (path->string (file-name-from-path path)))))
       (directory-list directory-path)))

    (define/private (directory-change-catcher)
      (define f (filesystem-change-evt (current-directory-for-user)))
      (thread (λ ()
                (sync f)
                (displayln "caught2!")
                (map (λ (i) *(send this delete-item i)*) (send this


(define nav-hlist (new directory-hlist% [parent window]
                       [directory-path (current-directory-for-user)]))

(send window show #t)

You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to