Brilliant thanks.<div>Stephen<span></span><br><br>On Thursday, March 28, 2013, Diogo F. S. Ramos wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Stephen De Gabrielle <<a href="javascript:;" onclick="_e(event, 'cvml', 'stephen.degabrielle@acm.org')">stephen.degabrielle@acm.org</a>> writes:<br>
<br>
> You can use the FFI to pull in more Gtk, Win32, or Cocoa widgets<br>
> on the<br>
> corresponding platform. The `get-handle' and `get-client-handle'<br>
> methods of a `window<%>' provide access to the underlying GUI<br>
> toolkit's<br>
> object, which lets you mix `racket/gui' windows and naive widgets.<br>
><br>
> I'm fascinated by this, I'm having trouble locating an example where<br>
> it is used to bring in a native control.<br>
<br>
The following code brings up a toggle button from GTK+.<br>
<br>
Hope this helps. :^)<br>
<br>
<br>
#lang racket/gui<br>
<br>
(require ffi/unsafe)<br>
<br>
(define gtk-toggle-button-new-with-label<br>
(get-ffi-obj "gtk_toggle_button_new_with_label"<br>
#f<br>
(_fun _string -> _pointer)))<br>
(define gtk-container-add<br>
(get-ffi-obj "gtk_container_add"<br>
#f<br>
(_fun _pointer _pointer -> _void)))<br>
(define gtk-widget-show<br>
(get-ffi-obj "gtk_widget_show"<br>
#f<br>
(_fun _pointer -> _void)))<br>
<br>
(define win (new frame% (label "hello, world")))<br>
<br>
(define toggle (gtk-toggle-button-new-with-label "toggle me"))<br>
(gtk-widget-show toggle)<br>
(gtk-container-add (send win get-client-handle) toggle)<br>
<br>
(send win show #t)<br>
</blockquote></div><br><br>-- <br><div> </div><div>--</div><div>Stephen De Gabrielle</div><div><a href="mailto:stephen.degabrielle@acm.org" target="_blank">stephen.degabrielle@acm.org</a></div><div>Telephone +44 (0)20 85670911</div>
<div>Mobile +44 (0)79 85189045</div><div><a href="http://www.degabrielle.name/stephen" target="_blank">http://www.degabrielle.name/stephen</a></div><div>----</div><div>Professor: Oh God! I clicked without reading! </div>
<div>Cubert: And I slightly modified something I own! </div><div>Professor: We're monsters!</div><br>