[racket] Applications on OS X

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Dec 30 12:57:08 EST 2012

Did you mean to include

 (send frame show #t)

in the function for `application-file-handler'?

I get a frame when I add that.

At Sun, 30 Dec 2012 09:04:36 -0800, Eric Dobson wrote:
> I'm trying to make an application on os X and get it to respond to drag and
> drop/giving it a file. But I cannot get either
> application-start-empty-handler or application-file-handler to get called.
> Am I doing something wrong? The documentation says that they should be
> called. It also says that the arguments are passed into the current command
> line arguments, but that also doesn't seem to be done.
> 
> My program. (tmp.rkt)
> 
> #lang racket/gui
> 
> (application-start-empty-handler
>   (λ ()
>     (define frame (new frame% (label "start")))
>     (define label (new message% (label "hello") (parent frame)))
>     (void)))
> 
> (application-file-handler
>   (λ (file)
>     (define frame (new frame% (label "file")))
>     (define label (new message% (label (format "~a" file)) (parent frame)))
>     (void)))
> 
> (define frame (new frame% (label "tmp")))
> (define label (new message% (label (format "~a"
> (current-command-line-arguments))) (parent frame)))
> (send frame show #t)
> 
> 
> Built with:
> raco exe --gui -l tmp.rkt
> 
> Tried opening app with 'tmp.rkt' as an argument:
> open -a tmp.app tmp.rkt
> and
> right clicking tmp.rkt, and selecting open with tmp.app
> 
> This always resulted in just the 'tmp' frame being created with the empty
> vector message. I know racket can do this because DrRacket works with this
> on my system.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.