All Manuals > Common Lisp Interface Manager 2.0 User's Guide > Chapter 8 Presentation Translators in CLIM > 8.5 Examples of Defining Presentation Translators in CLIM

NextPrevUpTopContentsIndex

8.5.1 Defining a Translation from Floating Point Number to Integer

Here is an example that defines a presentation translator to accept an integer object from a float presentation. Users have the options of typing in a float or integer to the input prompt or clicking on any float or integer presentation.

(define-presentation-translator integer-to-float 
  (integer float my-command-table 
           :documentation "Integer as float" 
           :gesture :select 
           :tester ((object) (integerp object)) 
           :tester-definitive t)
  (object) 
  (float object))
 
(clim:present most-positive-fixnum)
 
(clim:accept 'float)

Common Lisp Interface Manager 2.0 User's Guide - 7 Aug 2017

NextPrevUpTopContentsIndex