le 2001/09/21 15:48, Jay Reeve à jktr@... a écrit : [snip] > Please forgive. :-) you are forguve, sir. >> ps. thanks for taking the time to clean the code. however i would protest a >> number of things... you cut middle truncation [apple notes this is preferred >> for something like a path name, and even your example code]. > If I included it in my example, how did I cut it? Did you see the note: i repost my code: look at 'myType', i don't see this is your code? for the 'middle' truncation. example: this is standard trunc example: middle trunc like this '------------- start code --------------------------------------------- /* truncates a passed string according to 'myType' and returns it. myTargetStr: the passed pascal string myType: _zTrue -> truncate at end _false -> truncate in middle myLen: length in pixels that string must fit in myMin: if intelligent truncation makes it smaller than this then use standard truncation. */ local mode local fn doTruncStr$( myTargetStr as str255,myType as int, [+] myLen as int,myMin as int) dim myCntr as int dim myString as str255 ' long if( myType) /* myType is true so do 'end' truncation, using 'intelligent' first then standard. */ long if( fn stringwidth( myTargetStr) > myLen) // try intelligent truncation first myString = myTargetStr for myCntr = myTargetStr[0] to 1 step -1 long if( myString[ myCntr] = 32) myString[0] = myCntr -1 if( fn stringwidth( myString) < myLen) then exit for end if next long if( FN stringwidth( myString) > myMin) myTargetStr = myString xelse myLen = fn TruncString( myLen,myTargetStr,0) end if end if xelse /* myType is false we come here and do 'middle' truncation missing from jay's code */ myLen = fn TruncString( myLen,myTargetStr,&h4000) end if end fn = myTargetStr '------------ end code ------------------------------------ >> For standard truncation, set myMin = MyLen > I viewed it as eliminating 1 param and 1 LONG IF block without losing any > of the functionality. If you want to reintroduce it, you can do so by > adding the myType param and the following line: > IF myType THEN myMin = myLen > but that seems superfluous to me. > Or do I not understand what you mean by "middle"? you misunderstand sir. see above with new comments. >> secondly i >> deliberately used FB^3 notation, and you reintroduced [the passed params] >> FBII notation. > Yep. I personally like the fact that we have shorthand notations > available, and I will use them whenever it will allow me to avoid a > (potentially problematic) line break. I have not understood the use of > [+] for the line-break char, when the latter works fine for many of us. > If you wish to use the code, please feel free to change it to whatever > you prefer. it's just that alain has spent ages 'gently' persuading me of the merits of the 'new' notation. thanks for taking the time. :-j