Saving changes to a text-input-pane
I'm writing a UI in LispWorks as a front-end to a database, on Mac
Cocoa, using text-input-panes to allow the user to edit text in the
database.
I'm using editing-callback to save changes to the database when the
user tabs off a field, using:
:editing-callback #'(lambda (pane type) (case type (:end (save-field
pane))))))
However, the callback doesn't get called if the user leaves the
cursor in the field, and closes the window.
To save the field in this case I tried using destroy-callback in the
interface:
:destroy-callback #'(lambda (interface) (save-field (find-focus-in-
pane (capi:pane-layout interface)))
where find-focus-in-pane is defined as:
(defun find-focus-in-pane (pane)
(capi:map-pane-descendant-children pane
#'(lambda (p)
(when (capi:pane-has-focus-p p)
(return-from find-focus-in-pane p)))))
However find-focus-in-pane always returns nil, presumably because the
destroy-callback is called after the field loses focus on closing the
window.
Any suggestions about the correct way to do this?
Many thanks,
David Johnson-Davies
+------------------------------------------------------------+
David Johnson-Davies, Human-Computer Interface Ltd
17 Signet Court, Swanns Road, Cambridge, CB5 8LA, England.
Tel: +44 1223 314934, Fax: +44 1223 462562
Email: david@interface.co.uk, Web: http://www.interface.co.uk/
+------------------------------------------------------------+