Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Curses Programming 1

Status
Not open for further replies.

GouseBaig

Programmer
Oct 20, 2003
4
US
Hi everybody,

I am working on a solaris box using vt100 terminal. I didnt have xterm or any graphic supported terminals.

I need to write a small applications having a screen and some menu options. Based on the user selection on menus , it has to fetch some data from file/database and display, some time draw a form and capture the input from the user and etc ...

I didnt tried anything with curses/ncurses. I need guidlines to start on this. I need some usefull reference sites or if any one can send some sample programs also will help me.

Any Small help will be appriciated.


Thanx
baig.



 
Thanx saleem and singh.

I was going through those links and its good.

But I am not able to find any solid examples for menu programs using curses.

I am trying to create a screen with menus. I have written a small sample program, its getting failed and I need to close my terminal since my prompt messages are becoming junk.

Here is that sample program.

============================================================
#include <menu.h>

int main ()
{
WINDOW *w [2] ;

ITEM *menu1_items [4] ;

MENU *menu1 ;

OPTIONS opts ;

int index ;

initscr () ;
refresh () ;

w [1] = stdscr ;
scrollok ( w[1], TRUE ) ;
box ( w[1], '*', '*' ) ;

touchwin ( w[1] ) ; wrefresh ( w[1] ) ;

menu1_items [0] = new_item ( &quot;Add&quot; , &quot;Add-&quot; ) ;
menu1_items [1] = new_item ( &quot;Delete&quot; , &quot;Delete-&quot; ) ;
menu1_items [2] = new_item ( &quot;List&quot; , &quot;List-&quot; ) ;
menu1_items [3] = new_item ( &quot;Update&quot; , &quot;Update-&quot; ) ;

menu1 = new_menu ( menu1_items ) ;

opts = O_ONEVALUE | O_SHOWDESC | O_SHOWMATCH | O_ROWMAJOR | O_IGNORECASE ;
set_menu_opts ( menu1, opts ) ;

set_menu_format ( menu1, 3, 1) ;

post_menu ( menu1 ) ;

refresh () ;
wrefresh ( w[1] ) ;

getch () ;

unpost_menu ( menu1 ) ;

for (index = 0 ; index <= 3 ; index ++ )
{
free_item ( menu1_items [ index ] ) ;
}

free_menu ( menu1 ) ;

endwin () ;

}

============================================================

I am unable to find the problem.

If anyone help me by giving solid example programs with menus and multi screens, it will be great.

Thanks and Regards
baig.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top