Re: Simple way to find number of visible rows and columns?
- Thanks, Eb. This is similar to the clip I wrote except my clip creates a temporary new doc to work in and fills the screen with text. An issue with your code is that the number of rows is not correct if there are less than a screen full of rows since I want the maximum number of rows that can be displayed (screen size) and not the number actually displayed. In other words, if 20 rows can fit and there are only 10, your code will report 10 instead of 20.
In other words, I guess there isn't a direct way of doing this.
Another idea for the enhancement list!
Also, for beginners following along, the corrected lines should be
--- In email@example.com, "Eb" wrote:
> Here's a tip to get rows:
> ^!Keyboard CTRL+PAGEUP
> ^!Set %top%=^$GetRow$
> ^!Keyboard CTRL+PAGEDN
> ^!Set %not%=^$GetRow$
> ^!Set %numrows%=^$Calc(^%bot%-^%top%)$
> gets you the number of rows.
> ^!Jump LINE_START
> ^!Set %old%=^$GetRow$
> ^!InsertText ^$StrFill("x ";200)$^%nl%
> ^!Jump ^%old%
> ^!Select EOL
> ^!Set %numcols%=^$GetSelSize$
> ^!Menu Edit/Undo
> gets you the number of columns
> Potential problem: you insert into the middle of a wrapped line. I haven't tested that.
> --- In firstname.lastname@example.org, "joy8388608" wrote:
> > I looked and looked but cannot find any functions to tell how many columns and rows are visible on the main NT text screen. These values change as the window is resized, frames are opened (outline, libraries, etc) font is changed...
> > It can be done in a clip but it's not the prettiest thing and involves creating a new document, filling it with long lines, and moving around in it a bit to get the values. I was wondering if anyone knew of a fairly direct way.
> > Thanks,
> > Joy