[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

focus problem - what's wrong?



Hi all,
I'm using DrScheme 103 and I've some problems to control the focus by
program. From a bigger application I have extracted this short example.
The buttons are simulating other parts which have to set the focus to
certain input areas. All works fine with the buttons "focus to second"
and "focus to third", but if the window is hidden and shown again, it
will not set the focus.
What's wrong?

(make-object
  (class* dialog% () initvars
    (private (the-panel void)
             (ed1 void)
             (ed2 void))
    (sequence (super-init "TEST" #f 200 200 200 200 null)
              (set! the-panel (make-object vertical-panel% this
'(border)))
              (set! ed1 (make-object editor-canvas% the-panel
                          (make-object text% 1.0 null)
                          '(no-hscroll no-vscroll) 1))
              (set! ed2 (make-object editor-canvas% the-panel
                          (make-object text% 1.0 null)
                          '(no-hscroll no-vscroll) 1))
              (make-object button% "test" the-panel
                (lambda (x y)
                  (send this show #f)
                  (send this show #t)
                  (send ed1 focus))
                null)
              (make-object button% "focus to third" the-panel
                (lambda (x y) (send ed1 focus)) null)
              (make-object button% "focus to second" the-panel
                (lambda (x y) (send ed2 focus)) null)
              (send this show #t))))

--
****************************************************************
   Joerg KIPPE
   Fraunhofer-Institut fuer Informations- und Datenverarbeitung
   Fraunhoferstr. 1
   D-76131 Karlsruhe
   Email:        mailto:kip@iitb.fhg.de
   Telephone:    +49-721-6091-337
   FAX:          +49-721-6091-413
****************************************************************