I have a problem with the Racket GUI where the main application window 
focus if two dialog boxes are opened than closed.  The problem occurs when 
main window opens the first dialog box and the first dialog box opens the
second one on top of it.  Once both dialog boxes are closed, the main window
looses focus and goes to the bottom of the window stack (i.e. behind other
windows).  This does not seem to happen if only one dialog box is opened 
closed -- in that case the main window will have the focus.

Could someone confirm if this behaviour is seen on other platforms (I use
Windows), and perhaps offer a workaround?

I attached a sample application that illustrates the problem below and you 
also find the code here:

Too see the problem, this code needs to be compiled into a stand-alone
executable (using the Racket/Create Executable... from DrRacket).

    #lang racket
    (require racket/gui)

    (define toplevel (new frame%
                          [label "Hello World"]
                          [width 800]
                          [height 600]))
    (define dialog-1 (new dialog%
                          [parent toplevel]
                          [label "Dialog 1"]
                          [width 400]
                          [height 300]))
    (define dialog-2 (new dialog%
                          [parent dialog-1]
                          [label "Dialog 2"]
                          [width 200]
                          [height 150]))

    (define (on-open-dialog1 button event)
      (send dialog-1 show #t))

    (define (on-close-dialog1 button event)
      (send dialog-1 show #f))

    (define (on-open-dialog2 button event)
      (send dialog-2 show #t))

    (define (on-close-dialog2 button event)
      (send dialog-2 show #f))

    (define b1 (new button%
                    [parent toplevel]
                    [label "Open Dialog 1..."]
                    [callback on-open-dialog1]))
    (define b2 (new button%
                    [parent dialog-1]
                    [label "Open Dialog 2..."]
                    [callback on-open-dialog2]))
    (define b3 (new button%
                    [parent dialog-1]
                    [label "Close Dialog 1"]
                    [callback on-close-dialog1]))
    (define b4 (new button%
                    [parent dialog-2]
                    [label "Close Dialog 2"]
                    [callback on-close-dialog2]))

    (send toplevel show #t)


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