[racket] Embedding a GUI editor into Slideshows

From: Rodolfo Carvalho (rhcarvalho at gmail.com)
Date: Sat Jun 11 15:36:37 EDT 2011

Robby, your suggestion didn't work with 5.1.1 under Ubuntu.

The difference is that multiple clicks instantiates multiple windows, but
none of them were shown on top.

Anyway I am satisfied with the current state. I can launch other apps using
racket/system and they do take focus!
For example I was able to open a file on Gedit:


#lang slideshow
(require racket/gui racket/system)

*(define (launch-app cmd)*
*  (system cmd))*

(define frame (new frame% [label "Example"]))

(define msg (new message% [parent frame]
                 [label "No events so far..."]))

(new button% [parent frame]
     [label "Click Me"]
     (callback (λ (button event)
                 (send msg set-label "Button click"))))

(slide
 #:title "Test"
 (clickback (hyperlinkize (t "Hello"))
            (λ () (send frame show #t)))
 *(clickback (hyperlinkize (t "Gedit"))*
*            (λ () (launch-app "gedit /proc/cpuinfo")))*)




[]'s

Rodolfo Carvalho


On Sat, Jun 11, 2011 at 15:57, Robby Findler <robby at eecs.northwestern.edu>wrote:

> That does work for me, in the latest pre-release under mac os x. I
> have a vague recollection that there was a linux bug related to this
> that has been fixed, but I'm not sure.
>
> One thing to try to work around it (if upgrading isn't an option) is
> to actually create the frame inside the callback:
>
> #lang slideshow
> (require racket/gui)
>
> (slide
>  #:title "Test"
>  (clickback (hyperlinkize (t "Hello"))
>            (λ ()
>              (define frame (new frame% [label "Example"]))
>
>              (define msg (new message% [parent frame]
>                               [label "No events so far..."]))
>
>              (new button% [parent frame]
>                   [label "Click Me"]
>                   (callback (λ (button event)
>                               (send msg set-label "Button click"))))
>
>               (send frame show #t))))
>
>
> Robby
>
> On Sat, Jun 11, 2011 at 12:10 PM, Rodolfo Carvalho <rhcarvalho at gmail.com>
> wrote:
> > I tried the following, but the new frame is not shown on top of the slide
> (I
> > need to alt-tab to see it):
> >
> > #lang slideshow
> > (require racket/gui)
> > (define frame (new frame% [label "Example"]))
> > (define msg (new message% [parent frame]
> >                  [label "No events so far..."]))
> > (new button% [parent frame]
> >      [label "Click Me"]
> >      (callback (λ (button event)
> >                  (send msg set-label "Button click"))))
> > (slide
> >  #:title "Test"
> >  (clickback (hyperlinkize (t "Hello"))
> >             (λ () (send frame show #t))))
> >
> > Suggestions?
> > []'s
> > Rodolfo Carvalho
> >
> >
> > On Sat, Jun 11, 2011 at 11:00, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> >>
> >> You could have a clickback in a slide that creates a new frame on top
> >> of the Slideshow frame. That approach has worked ok for me.
> >>
> >> At Fri, 10 Jun 2011 17:58:21 -0300, Rodolfo Carvalho wrote:
> >> > Hello everybody,
> >> >
> >> > Has anyone had the experience of embedding a "live code editor" into
> >> > Slideshow?
> >> >
> >> > I woke up with this idea for a coming presentation, I would talk with
> >> > slides
> >> > and from time to time I would show a code editor, type, and run a
> script
> >> > (not necessarily racket code) and see the result / show to the
> audience.
> >> >
> >> > Of course this could be done alt-tabbing out of the presentation, but
> it
> >> > would be cool to have something that follow along the presentation.
> >> >
> >> > Was it just a crazy dream?
> >> >
> >> > []'s
> >> >
> >> > Rodolfo Carvalho
> >>
> >
> >
> > _________________________________________________
> >  For list-related administrative tasks:
> >  http://lists.racket-lang.org/listinfo/users
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110611/da879b9b/attachment.html>

Posted on the users mailing list.