Curses: Drawing Boxes -- sending control chars

Mark F. Proudman mfp at sobeco.UUCP
Sun Aug 28 05:28:56 AEST 1988


In article <873 at wpg.UUCP>, russ at wpg.UUCP (Russell Lawrence) writes:
> 
> The curses box() function draws crude boxes around windows using ascii 
> characters like '|' and '-' that are passed to the function as 
> arguments.  By contrast, I'd like to write a better box drawing routine 
> that would take advantage of box drawing graphics capabilities on some 
> terminals.  Unfortunately, the terminfo definitions don't include any 

I have just written a menu handler, to run on vt[123]xx terminals.
The attribute bits of each curses displayed character include one
#defined as A_PROTECT.  Normally useless; I changed the terminfo sgr
string so that A_PROTECT (p8 I think) invokes a change to graphics 
character set sequence.  When I want a graphic, I just addch the ascii
equivalent, with A_PROTECT on.

Of course, your box routine  will have to know which character
position each graphic is in.  Possibly download a DEC compatible graphic
character set, if your terminals don't have one.  Or implement your
idea of a database of graphic characters:  Having stolen an attribute
bit, you won't need escape sequences in the database.  Or simply put a
lot of if's in your code (gross, non portable but effective).


Mark Proudman	uunet!attcan!sobeco!mfp
		(514) 878 9090
"It is agreed that the ice is thin here" - K&R.



More information about the Comp.unix.questions mailing list