MiddleValues, like any of the functions that have a name ending in "...values", does not simply return the value from the list. It returns the value plus a return character. Don't know why the FileMaker Inc. programmers did that to the "Values" functions but that's what they do. In place of MiddleValues, use GetValue as in
GetValue ( TabList ; i )
and your function will return just the listed value without including that extra return.
It could be that the MiddleValues function called by UI_Tab_Selection is appending a carriage return to the returned results.
According to the FMP Help for MiddleValues:
Your suggestion solved the issue.
Thanks a lot.