Lisp HUG Maillist Archive

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/
+------------------------------------------------------------+


Re: Saving changes to a text-input-pane

David Johnson-Davies wrote on Thu, 24 Dec 2009 11:31:39 +0000 14:31:

| 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:
|...snip...|

I would recommend a kind of "changed" slot in your pane, which is set ON on
starting editing and OFF on saving changes in the database successfully.

YMMV, I usually save changes in a record-scoped or interface-scoped manner,
not after editing every field.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru


Re: Saving changes to a text-input-pane

Unable to parse email body. Email id is 9627

Updated at: 2020-12-10 08:40 UTC