How to? Understanding @select[]

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
I used @select[] successfully for a long time in 4NT but am finding its behavior somewhat baffling in TCC.

I have a two-line text file "test.tmp". Both lines contain filenames that aren't especially long.

This command:

echo %@select[test.tmp,0,49,300,200,Pick a filename]

produces a SELECT window about an inch and a half wide. The filenames are cut off at the right.

This command -- with the second argument incremented by only 1:

echo %@select[test.tmp,0,50,300,200,Pick a filename]

produces a SELECT window that runs off the right edge of the screen and has to be dragged leftward to be seen in its entirety. (So the filenames are cut off on the right edge in the first case and have a ton of white-space to their right in the second.)

Why is this? What am I doing wrong in both cases? (I've been having trouble understanding @select[]'s logic in how it displays its window. So I chose the other numbers in the command somewhat arbitrarily.)


Scott Mintz
May 20, 2008
Solon, OH, USA
If the specified width is < 150, the top, left, bottom, right parameters are assumed to be rows/columns relative to the TCC window. If the width is >= 150, the parameters are assumed to be screen coordinates (in pixels).

Your width in your first example is 151 (200 - 49), so the values are interpreted as pixels. Given the behavior you describe for the second, I'm guessing that width has to be > 150 and not >= 150, because you created a window that was 150 characters wide (200 - 50).
Ok, I get my error with the width now -- thanks for that.

I continue to see SELECT windows in which the last line is cut off, no matter what height I give the window. If I add a blank line to the end of the text file I'm "feeding" to @select[], then I see the last visible line in the file. But that kind of workaround is kind of unpleasant and shouldn't be necessary.

The SELECT window seems to adjust itself to the height of its contents, rather than to the height requested via the @select[] command. That was not how it worked in 4NT. At least, not that I recall.

With the two-line text file (which does have <cr><lf> as its last characters, if it matters):

%@select[test.tmp,0,0,75,60,Pick a filename]

...the second of the two filenames is not fully visible in the SELECT window. But then:

echo.>> test.tmp

Now there's a blank line at the end of the text file. I use the same parameters for @select[], and now both of the visible lines containing filenames can be seen -- and the window cuts off the blank line. This is not an especially welcome sort of workaround. It would call for additional batch code to deal with: what if the selection is "" BUT the user hasn't pressed Esc? I don't even know if it's possible to make that distinction.

I have reported this cutting-off at the bottom of the window before. Can anyone replicate it? Or is there some obviously mis-set @select[] parameter that I've simply overlooked?

( TCC 15.01.52 x64 Windows 7 [Version 6.1.7601] )