LispWorks CAPI User Guide > 6 Laying Out CAPI Panes > 6.4 Constraining the size of layouts > 6.4.3 Constraint Formats

NextPrevUpTopContentsIndex String constraints

To make a pane that is wide enough to accomodate a given string, use the :visible-min-width hint with a (:string string ) constraint.

In this example we also supply :visible-max-width t , which fixes the maximum visible width to be the same as the minimum visible width. Hence the pane is wide enough, but no wider:

(defvar *text* "Exactly this wide")
 (make-instance 'capi:text-input-pane
                :text *text*
                :visible-min-width `(:string ,*text*)
                :visible-max-width t
                :font (gp:make-font-description
                       :size (+ 6 (random 30)))))

Note that the width constraint works regardless of the font used.

LispWorks CAPI User Guide (Unix version) - 22 Dec 2009