User avatar
tonyhughes
Posts: 951
Joined: Wed Dec 26, 2012 3:46 am

Row/columns for text mode app?

Wed Mar 13, 2013 3:56 am

I have an app that presents information via whiptail.

All my devices are fairly large screens - e.g. 1280x1024 or better, so I generally have a good number of rows and columns in text mode.

Some of my users are reporting usability problems, with portions of my screens being cut off, I presume because they have smaller displays/windows.

What number of rows/columns is safe to develop for/use as a minimum requirement?

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Row/columns for text mode app?

Wed Mar 13, 2013 11:22 am

tonyhughes wrote:I have an app that presents information via whiptail.

All my devices are fairly large screens - e.g. 1280x1024 or better, so I generally have a good number of rows and columns in text mode.

Some of my users are reporting usability problems, with portions of my screens being cut off, I presume because they have smaller displays/windows.

What number of rows/columns is safe to develop for/use as a minimum requirement?
80x24.

Even then, on a Pi using composite video output to a crappy old TV it might be less than 80 wide. Assume 40x24.

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
tonyhughes
Posts: 951
Joined: Wed Dec 26, 2012 3:46 am

Re: Row/columns for text mode app?

Wed Mar 13, 2013 11:24 am

Thanks :)

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Row/columns for text mode app?

Wed Mar 13, 2013 11:25 am

You can ask how big the screen is. I think it's probably in nCurses. That's how "more" knows how many lines to display at a time.

User avatar
gordon@drogon.net
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: Row/columns for text mode app?

Wed Mar 13, 2013 11:31 am

rurwin wrote:You can ask how big the screen is. I think it's probably in nCurses. That's how "more" knows how many lines to display at a time.
In a bash script you can parse the output of

stty -a

the first line - e.g.

speed 38400 baud; rows 64; columns 80; line = 0;

has what you need.

not a lot of help if you want to display big boxes though! But there are *nix tools to help you - e.g. the fmt] command and so on. (I've never used whiptail, so don't know what it offers in that department)

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
rpdom
Posts: 15168
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Row/columns for text mode app?

Wed Mar 13, 2013 2:09 pm

In bash you can use the shell variables LINES and COLUMNS to see how big the current screen/window is.

Return to “General programming discussion”