Some follow-up to my previous message (which, I guess, everyone was waiting 
for given the seemingly large interest :)

I tried using quickscript to get access to the interaction window and add 
the snip from there and it works.
I feel that this might confirm my hypothesis regarding not being in the 
right event space but I could use some help here.

The quickscript script I used:
#lang racket/gui
(require quickscript/script)

(define (show-dialog)
  (define f (new dialog% [label "Dialog"] [style '(close-button)]))
  (define m (new message% [label "Clicked"] [parent f]))
  (send f show #t))

(define (make-snip)
  (define t (new text%))
  (send t insert "Click Me!")
  (send t set-clickback
        0 (send t last-position)
        (lambda (t s e)
          (show-dialog)))
  (define s (new editor-snip% [editor t]))
  s)

(define-script inspector
  #:label "inspector"
  (λ (selection #:interactions i)
    (send i insert (make-snip))
    #f))

Regards
Philippe


On Thursday, September 27, 2018 at 9:02:29 PM UTC+2, Philippe M wrote:
>
> Hi,
>
> It seems that clickbacks are not working when a snip is displayed in 
> DrRacket interaction window.
>
> Here is a sample program:
> #lang racket/gui
>
> (define (show-dialog)
>   (define f (new dialog% [label "Dialog"] [style '(close-button)]))
>   (define m (new message% [label "Clicked"] [parent f]))
>   (send f show #t))
>
> (define f (new frame% [label "Test"] [width 300] [height 200]))
> (define e (new text%))
> (define c (new editor-canvas% [parent f] [editor e]))
> (send f show #t)
>
> (define t (new text%))
> (send t insert "Click Me!")
> (send t set-clickback
>       0 (send t last-position)
>       (lambda (t s e)
>         (show-dialog)))
> (define s (new editor-snip% [editor t]))
>
>
> (send e insert s)
>
>
> If you click on the Click Me text you will get the dialog displayed.
> If I enter 's' (without the quotes) in DrRacket interaction window, I can 
> see my snip displayed but clicking on it does nothing.
>
> I looked at DrRacket code but did not find anything that makes me think it 
> should not work except, maybe, for the fact that the snip is sent using the 
> text:send-snip-to-port function which serializes the snip to the proper 
> event space using text:make-snip-special.
>
> Could someone enlighten me on why it is not working as I expect and how I 
> could make this works ?
>
> Thanks for your help
> Philippe
>
>
>
>

-- 
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