From: Busch, Ciske

Subject: Where's my Key-Down-Event?

Date: 2000-6-14 14:52

Hi,

I need a control that looks like a static text but 
allows it's text to be edited if the user
mouse-clicks into it. After he has either pressed
ENTER or TAB or after he has mouse-clicked somewhere
else the control should look like a static text again and 
- most important - should not have keyboard focus anymore.

(I tried to solve this by using a static text and opening
a temporary editable-text at the same position after the
user clicked into the static-text. Removing the editable-text
works fine when using mouse-clicks but not when pressing 
enter or tab.)

Unfortunatly I do not know how to move the keyboard focus 
away from that control after the user has finished editing.

I tried to use the VIRTUAL-KEY-DOWN method to achieve this
but neither the used dialog nor the editable-text receive 
that event.

Can anybody give me a hint on what I am doing wrong here?

I have included a simple example. It contains a dialog
and an editable-text-control. As soon as the control 
is installed using TRACE shows that no VIRTUAL-KEY-DOWN-EVENTS
are generated anymore...


(defclass my-dialog (dialog) ())
(defclass my-text (editable-text)())

(defparameter dtest (make-window :my-dialog 
                                 :device 'my-dialog
                                 :exterior (make-box 26 65 306 255)))

;;; this works fine...
(defmethod virtual-key-down ((self my-dialog) buttons data)
  (declare (ignore buttons))
  (format t "~%Dialog: ~a" data)
  (call-next-method))

;;; ... until I add the text-control. 
(ADD-COMPONENT 
 (make-instance 'my-text
     :name :ltext
     :exterior (make-box 10 10 50 40)
   )
 dtest)

;;; Now I do not recieve the Key-Down for the dialog
;;; nor for the editable text

(defmethod virtual-key-down ((self my-text) buttons data)
  (declare (ignore buttons))
  (format t "~%Text: ~a" data)
  (call-next-method))


Any help would be greatly appreciated.

Ciske Busch