home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / UTILITY / SCREEN / CURSESP.ZIP / HINTS.TXT < prev    next >
Encoding:
Text File  |  1991-12-03  |  3.3 KB  |  83 lines

  1.  
  2. HINTS for using this copy of pc curses.
  3.  
  4. Compiler
  5. --------
  6.    BorlandC++ is recommended. I use this compiler to build this version
  7.    of PC curses. The C++ interface is also supported well. I check for 
  8.    the macros  __CPLUSPLUS__  in the header file curses.h
  9.  
  10.    If your compiler is not from Borland then you have to define this
  11.    before the #include <curses.h>
  12.  
  13.    Example:
  14.                 #define __CPLUSPLUS__
  15.                 #include "curses.h"
  16.  
  17. EGA/VGA modes
  18. -------------
  19.    Different textmodes (lines number > 25, more columns etc ...) are not
  20. supported directly by pc curses. However you are free to set the text 
  21. mode up using calls from your C library. BorlandC provides all the functions
  22. to tailor the text mode. I have not tried this! just hope it will be OK.
  23. The inform curses about the new dimensions by 
  24.  
  25.         COLS    =       number_of_columns;
  26.         LINES   =       number_of_lines;
  27.  
  28.  
  29. Undestructive  messages
  30. -----------------------
  31.    This is an advanced feature you may want to do. You will sometime want 
  32. to display a message then redraw the window quickly. To avoid overhead you
  33. can save the area to be overwritten away, display the message, wait for 
  34. the reaction from the user, then paste the saved buffer back instantly.
  35.  
  36.    The two routines to use are : 
  37.  
  38.         int  winch (WINDOW *win, int y, int x)              read
  39.         void winsch(WINDOW *win, int y, int x, int c)       write
  40.  
  41.    However, these two routines are not working. I suspect that they
  42.    are buggy. I check the documentation of curses on UNIX and think
  43.    that they are not correct in PC curses. For the moment I provides
  44.    two routines until I get all the problems fixed.
  45.  
  46.         int  wgetatpos(WINDOW *win, int x, int y)           read
  47.         void wputatpos(WINDOW *win, int x, int y, int c)    write
  48.  
  49.    Simply declare an integer array, save the text (to be overwritten)
  50.    into it. Then go on draw your message. Then later put the message
  51.    back character by character using  winsch()
  52.  
  53. Problems affecting Novice users.
  54. -------------------------------
  55.  
  56.    - Your machine simply hang. This means your program corrupts the 
  57. memory of the system badly. This tend to happen when you use a bad
  58. pointer returned by a library call. The solution is always to chech 
  59. for the NULL pointer. If it is NULL it is not OK, your program should
  60. exits.
  61.  
  62.    - Your window does not update (drawn). This is because you have forgot 
  63. to call wrefresh(WINDOW *win). Sometimes you draw at the last line in
  64. the window and nothing shows up. Perhaps, you forget that lines start 
  65. from 0 and finish at lines - 1.
  66.  
  67.    - Your call to subwin() returns NULL. This is becuse subwin() expected
  68. the co-ordinates supplied to it to be absolute, in other words relative
  69. to the screen, not the parent window.
  70.  
  71.    - You like to have a nice background colour for you window but
  72. as soon as you draw text, the text background destroys the window 
  73. background. To solve this you have to make the text background colour
  74. the same as your window background colour.
  75.  
  76.      Example:
  77.  
  78.         wattrset(B_BLUE);               // set the BLUE background
  79.         werase(win);                    // erase your window 'win'
  80.         wattrset(B_BLUE | F_GRAY);      // set text bg = BLUE, fg = GREY
  81.         waddstr(win, 1, 1, "Hello");    // write a string out
  82.  
  83.