LOCAL lnLen, lnMax, lcString lnMax = 0 lcString = "" SELECT domenii SCAN IF lnMax < LEN(ALLTRIM(domenii.denumire)) lnMax = LEN(ALLTRIM(domenii.denumire)) lcString = ALLTRIM(domenii.denumire) ENDIF ENDSCAN * Translate character length to pixel length lnLen = TEXTWIDTH( thisform, this, lcString ) this.Columnwidths = TRANSFORM( lnLen ) ********************************************************************************* FUNCTION TEXTWIDTH( toForm, toObject, tcText ) ******************************************************************************** * * OVERVIEW: Returns the width, in pixels required to display a string in * the font specified for an object. * * PARAMETERS: * toForm An object reference to the form containing toObject * toObject The object that will display tcText * tcText The text to be displayed * * RETURNS: The number of pixels required to display tcText * LOCAL ; llFontBold, lcFontName, llFontItalic, lnFontSize, ; llFormFontBold, lcFormFontName, llFormFontItalic, lnFormFontSize, ; lnWidth WITH toObject llFontBold = .FontBold llFontItalic = .FontItalic lcFontName = .FontName lnFontSize = .FontSize ENDWITH WITH toForm llFormFontBold = .FontBold llFormFontItalic= .FontItalic lcFormFontName = .FontName lnFormFontSize = .FontSize .FontBold = llFontBold .FontItalic = llFontItalic .FontName = lcFontName .FontSize = lnFontSize lnWidth = .TextWidth( tcText ) .FontBold = llFormFontBold .FontItalic = llFormFontItalic .FontName = lcFormFontName .FontSize = lnFormFontSize ENDWITH IF VARTYPE( lnWidth ) # "N" lnWidth = 0 ENDIF RETURN lnWidth ENDFUNC && TEXTWIDTH()Good luck,