How to render solid borders in NCURSES windows


 
Thread Tools Search this Thread
Top Forums Programming How to render solid borders in NCURSES windows
# 1  
Old 06-23-2009
How to render solid borders in NCURSES windows

Hello All Gr8 Linux Developers Out There,

Background
=========
I have created a ncurses application that is suppose to run only on the Linux's virtual console. This application will heavily utilize the ncurses windows to show window-based UI to the user. I am using CentOS5.x. The terminal for the virtual console is set to (TERM=linux).

I used the following code sequence to initialize the ncurses environment
Code:
initscr();
    getmaxyx(stdscr,y,x);

    noecho();
    cbreak();
    start_color();

    init_color(3,700,700,700);
    clear();
    wclear(stdscr);

The Issue
========
Currently I am unable to render solid borders in my windows. Ncurses produces solid borders for the windows using extended ASCII characters. Since I am unable to make ncurses to use extended characters, I assume I must have missing some setting in my code (may be using termios API). Currently I am fully rely on the ncurses to setup my virtual console to render solid borders. I have also tried my applications on other platform such as Fedora Core 10, and again it fails to render solid borders. However, when I run it on any pseudo terminal (using PuTTY) where TERM=xterm, it clearly renders the solid borders as I like. So I presume that there is something with the terminal type and/or driver.

Question
=======
Kindly state what should I do to enable extended character support on my virtual terminal(console) so that ncurses can render solid borders for my windows. Or if there is any code that I should add to my application that will enables my virtual terminal (/dev/tty1) to show extended characters letting nucurses to draw solid borders.

Thanks
Kashif Ali Siddiqui
Another Linux Developer striving to become a gr8 developer
# 2  
Old 06-23-2009
It would appear that your current terminal type (linux) may have the capabilities for solid colors. Run infocmp linux to see what your actual capabilities are. The terminfo man page will help you figure these out.
# 3  
Old 06-24-2009
When I ran the infocmp command, it shows the following output
Code:
#	Reconstructed via infocmp from file: /usr/share/terminfo/l/linux
linux|linux console, 
	am, bce, ccc, eo, mir, msgr, xenl, xon, 
	colors#8, it#8, ncv#18, pairs#64, 
	acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376, 
	bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l\E[?1c, 
	clear=\E[H\E[J, cnorm=\E[?25h\E[?0c, cr=^M, 
	csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, 
	cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?25h\E[?8c, 
	dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, 
	dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, 
	flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, 
	ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, 
	il1=\E[L, ind=^J, 
	initc=\E]P%p1%x%p2%{256}%*%{1000}%/%02x%p3%{256}%*%{1000}%/%02x%p4%{256}%*%{1000}%/%02x, 
	invis=\E[8m, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, 
	kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, 
	kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, 
	kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, 
	kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, 
	kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, 
	kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, 
	khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, 
	kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m, 
	ri=\EM, rmacs=\E[10m, rmam=\E[?7l, rmir=\E[4l, 
	rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, 
	sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, 
	sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, 
	sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, smir=\E[4h, 
	smpch=\E[11m, smso=\E[7m, smul=\E[4m, tbc=\E[3g, 
	u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c, 
	vpa=\E[%i%p1%dd,

So kindly state so my virtual console can show extended characters (and enables ncurses to draw solid borders), and if so, then how can I do it.

Thanks.
- Kashif
# 4  
Old 06-24-2009
First, while in a VT, please invoke one of the system config scripts ending with "-tui" (text user interface) which are located in /usr/sbin. Is the screen output correct or not? Solid lines, etc?
# 5  
Old 06-25-2009
Yes, I tried the /usr/sbin/authconfig-tui, and it did give me the solid border UI, that I failed to achieve throu ncurses. Kindly state what should I do to get solid borders in my application windows.

Thanks
Kashif
# 6  
Old 06-30-2009
Anyone please.

I really need to know how can I make my ncurses to draw solid lines.

Kashif
# 7  
Old 06-30-2009
Quote:
Originally Posted by ku@ntum
Anyone please.

I really need to know how can I make my ncurses to draw solid lines.

Kashif
What is the code you're using to try to draw the solid lines? Are you using the ACS constants defined by NCurses, or are you just writing out extended-ASCII character codes?

You might want to check out some existing source code that does this - for instance, the "menuconfig" code in the Linux kernel (/usr/src/linux/scripts/kconfig/lxdialog/) - grep for ACS and you can find where it is done.

Using the ACS constants from the ncurses header is the portable solution, it will work correctly or fail gracefully on different types of terminals as long as they're set up correctly.

If you really find using ACS constants too complicated, there's an alternate option: there's a character attribute constant defined in ncurses.h called "A_ALTCHARSET". When this attribute is active, it will allow you to write out characters from the whole PC character set range - including those glyphs associated with control characters and those in the upper half of the character set. This solution is not portable, however - it's only for text consoles on PCs.

Now, I don't know if this information will solve your problem. I haven't tested this stuff. If you want me to help you further, try this stuff out. If it still doesn't work then you can provide more information about what your code is doing, and maybe I can help you out.

Last edited by tetsujin; 06-30-2009 at 05:43 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. What is on Your Mind?

On ResearchGate: Researchers render cyberspace like a 3D video game ... by Katherine Lindemann

FYI. On ResearchGate: Researchers render cyberspace like a 3D video game to make identifying threats easier 24th July 2017 by Katherine Lindemann Cybersecurity analysts may soon be able to travel through cyberspace like outer space and see attacks with the naked eye. On ResearchGate:... (3 Replies)
Discussion started by: Neo
3 Replies

2. Shell Programming and Scripting

Help needed in sending file content with colors and borders

HI i am running a shell script in cron and storing the output of that script in a file say test.then i am copying the content of test to test1 and i will send the output of test to some email ids using mutt. Next time when the script executes i am comparing the contents of test and test1 and... (3 Replies)
Discussion started by: venkitesh
3 Replies

3. Shell Programming and Scripting

Tables and borders

when i do this: cat HITS i get the following displayed: sport.hits:87.114.172.31 Thu Sep 28 22:45:12 GMT 2006 how do i put this information into a bordered table? so it will output like this: ...........File /... (9 Replies)
Discussion started by: amatuer_lee_3
9 Replies

4. UNIX for Dummies Questions & Answers

batch render

I'm interested in getting unix in my pc, can someone tell me where and how can I get it. I'm a complete virgin about unix, I work in 3d animation and i need unix to make batch rendering work in Maya. Another question is: how do I know what hardware is compatible with unix and do I need any drivers... (1 Reply)
Discussion started by: Vitor
1 Replies
Login or Register to Ask a Question