[racket] Getting Handle

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Sep 3 08:04:26 EDT 2012

At Mon, 03 Sep 2012 13:44:44 +0200, heraklea at gmx.de wrote:
> Hello friends,
> 
> I create and show a dialog like this:
> 
> (define (start-dialog)
> (define dialog (new dialog% [label "Test"]))
> (define msg (new message% [parent dialog]
>                           [label "Kein Ereignis bisher"]))
> (new button% [parent dialog]
>              [label "Drück Mich!"]
>              [callback (lambda (button event)
>                          (send msg set-label "Drücken"))])
> (send dialog show #t))
> 
> (define c1 (make-eventspace))
> (define (show-message)
> (parameterize ([current-eventspace c1])
>              (thread start-dialog)))
> 
> 
> How can I get the handle of the dialog. Or from a frame?

Do you mean that you want to get a Racket reference to the `dialog%'
object by finding out what window is frontmost? There's a
`get-top-level-focus-window' method, which might be what you want, but
it's eventspace-specific. You can discover the eventspace `c1' via
`custodian-managed-list', but only by arranging sufficient permission
(i.e, by having a custodian that manages the current custodian).

Or do you mean `HWND' on Windows? The `get-handle' method will give you
that handle.



Posted on the users mailing list.