Kyle Burton on Fri, 7 Jan 2000 17:53:14 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Ncurses


Oh, can you attach your code?  If I can comple/test/tinker, I might be
able to figure something out...

k

------------------------------------------------------------------------------
A witty saying proves nothing. 
    -- Voltaire 
mortis@voicenet.com                            http://www.voicenet.com/~mortis
------------------------------------------------------------------------------

On Fri, 7 Jan 2000, Tim Peeler wrote:

> This has got me stumped.  I'm trying to write a program in ncurses and so far
> I'm doing fairly well (for my first attempt at programming).  The problem I'm
> having is with refreshing the main windows right after the program loads.  I
> explicitly call wnoutrefresh and doupdate just before my input for loop, but
> the screen doesn't refresh until I press a key.  I use getch() in my input for
> loop, and if I disable the getch() the windows will update properly right after
> the program loads.
> 
> int main(int argc, char **argv)
> {
>    // Load resource file, process args, setup display,
>    // if there's errors display them, if it's fatal exit nicely.
>    exit_error(load_resource_file(resource_file));
>    exit_error(process_command_line_args(argc, argv));
>    exit_error(setup_display_env());
>    // explicitly refresh the windows!!!!!
>    // setup_display_env already setup the TopMenuWindow and HelpWindow
>    // along with several other windows (hidden) now I just need to update the
>    // display
>    wnoutrefresh(TopMenuWindow);
>    wnoutrefresh(HelpWindow);
>    doupdate();
>    for(;;){
>       // main_for_loop calls getch() to process keypresses
>       main_for_loop();
>    }
>    end_program(0);
> }                                                                               
> 
> int main_for_loop()
> {
>    short c;
>  
>    // get keyboard commands, if it isn't listed here then
>    // pass the key off to the command processor
>    if(c=getch()){
>       switch(c){
>        case KEY_F(8) :
>          end_program(0);
>          break;
>        case KEY_F(MAIN_MENU) :
>          // menus
>          touchwin(TopMenuWindow);   // TopMenuWindow already has data in it,
>          wrefresh(TopMenuWindow);    // just need to touch the window so it'll
>          display_menu(MAIN_MENU);  // redisplay and post properly.
>          break;                                                                 
> <snip>
> 
> If anyone has a clue as to why this is happening, please let me know.  Also, if
> anyone has any good pointers to a comprehensive ncurses book please let me know.
> 
> Thanks,
> Tim
> 
> _______________________________________________
> PLUG maillist  -  PLUG@lists.nothinbut.net
> http://lists.nothinbut.net/mail/listinfo/plug
> 


_______________________________________________
PLUG maillist  -  PLUG@lists.nothinbut.net
http://lists.nothinbut.net/mail/listinfo/plug