All Manuals > CAPI User Guide > 7 Laying Out CAPI Panes > 7.4 Constraining the size of layouts > 7.4.3 Constraint Formats

NextPrevUpTopContentsIndex

7.4.3.2 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")
 
(capi:contain
 (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.


CAPI User Guide (Windows version) - 30 Aug 2011

NextPrevUpTopContentsIndex