8.5 Examples of Defining Presentation Translators in CLIM

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)
  (float object))

(clim:present most-positive-fixnum)

(clim:accept 'float)

CLIM 2.0 User's Guide - OCT 1998

Generated with Harlequin WebMaker