Lisp HUG Maillist Archive

Passing a print-function to prompt-with-list

I'm trying to control the printing of items by prompt-with-list, but none of these attempts work. What am I doing wrong?

(capi:with-dialog-results (list ok)
    (capi:prompt-with-list
     '((a . 1) (b . 2)) "Test" 
     :interaction :multiple-selection
     :pane-args '(:print-function #'(lambda (x) (format nil "~a ~a" (car x) (cdr x)))))
  (when ok (print list)))

(capi:with-dialog-results (list ok)
    (capi:prompt-with-list
     '((a . 1) (b . 2)) "Test" 
     :interaction :multiple-selection
     :pane-args '(:print-function (lambda (x) (format nil "~a ~a" (car x) (cdr x)))))
  (when ok (print list)))

(flet ((fred (x) (lambda (x) (format nil "~a ~a" (car x) (cdr x)))))
  (capi:with-dialog-results (list ok)
    (capi:prompt-with-list
     '((a . 1) (b . 2)) "Test" 
     :interaction :multiple-selection
     :pane-args '(:print-function fred))
  (when ok (print list))))

Thanks for any help.
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: Passing a print-function to prompt-with-list

David Johnson-Davies <david@interface.co.uk> writes:

Although inconsistent with the documentation on CAPI:PROMPT-WITH-LIST,
directly passing it the :PRINT-FUNCTION keyword seems to work.

(capi:with-dialog-results (list ok)
     (capi:prompt-with-list
      '((a . 1) (b . 2)) "Test" 
      :interaction :multiple-selection
      :print-function #'(lambda (x) (format nil "~a ~a" (car x) (cdr x))))
   (when ok (print list)))


Regards,
BC


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