home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / c / cwl30 / cwl3demo / dialog2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-06  |  2.6 KB  |  98 lines

  1. #include "cwlwin.h"
  2. #include "dialog.h"
  3.  
  4. int display_choice(POPUP_MENU_PTR p, unsigned sel)
  5. {
  6.   int entry = 2;
  7.   if (p == pop)
  8.   {
  9.     do_stats(dbox,&entry);
  10.   }
  11.   return POPUP_CONTINUE;
  12. }
  13.  
  14.  
  15. void write_button_shadow(int row, int col, int len)
  16. {
  17.   WindowWriteRepeatCharacter(diagw, shadow_under, row, col, len);
  18.   WindowWriteRepeatCharacter(diagw, shadow_up, row - 1, col + len - 1, 1);
  19. }
  20.  
  21.  
  22. /* display the current choices in another window */
  23. int do_stats(FORMPTR form, int *entry)
  24. {
  25.   int tw = -1;
  26.   static int oldtw=-1;
  27.   static int choices[3]={0,0,0};
  28.   FormGetFieldData(dbox, 4, &tw);
  29.   if (oldtw != tw ||
  30.       FormGetRadioChoice(dbox,0) != choices[0] ||
  31.       FormGetRadioChoice(dbox,1) != choices[1] ||
  32.       FormGetRadioChoice(dbox,3) != choices[2] ||
  33.       *entry == 2)
  34.   {
  35.     oldtw = tw;
  36.     choices[0] = FormGetRadioChoice(dbox,0);
  37.     choices[1] = FormGetRadioChoice(dbox,1);
  38.     choices[2] = FormGetRadioChoice(dbox,3);
  39.  
  40.     WindowMoveCursor(statw, 0, 0);
  41.  
  42.     WindowPrintf(statw,
  43.       "Display Swapping      : %s     \n"
  44.       "Integer Format        : %s     \n"
  45.       "Screen Lines          : %s     \n"
  46.       "Tab Width             : %d     \n"
  47.       "Current List Choice   : %s       ",
  48.  
  49.       rstr1[FormGetRadioChoice(dbox, 0)],
  50.       rstr2[FormGetRadioChoice(dbox, 1)],
  51.       rstr3[FormGetRadioChoice(dbox, 3)],
  52.       tw,
  53.       ((FormGetListChoice(dbox,2) >= 0)?POPUP_ENTRY_STRING(pop,FormGetListChoice(dbox,2)):"No Selection"));
  54.     prev_field = *entry;
  55.   }
  56.   if (*entry != 2)  /* Popup window */
  57.     WindowChangeBorderAttribute(POPUP_WINDOW(pop),menu_colors2[BORDERCOLOR]);
  58.   return FIELD_CONTINUE_PROCESS;
  59. }
  60.  
  61.  
  62.  
  63. void change_stats(FORMPTR form, int entry, int current)
  64. {
  65.   do_stats(form, &entry);
  66. }
  67.  
  68.  
  69. /* write the help information when 'Help' is selected */
  70. write_help()
  71. {
  72.   WindowWriteCenterString(helpw, "General Help", 0);
  73.   WindowWriteCenterString(helpw, "────────────", 1);
  74.   WindowWriteString(helpw, "Next  Field - TAB", 3, 0);
  75.   WindowWriteString(helpw, "Prev. Field - SHIFTTAB", 4, 0);
  76.   WindowWriteString(helpw, "Accept      - ENTER", 5, 0);
  77.  
  78.   WindowWriteCenterString(helpw, "Radio Field Help", 7);
  79.   WindowWriteCenterString(helpw, "────────────────", 8);
  80.   WindowWriteString(helpw, "Next  Entry - ", 10, 0);
  81.   WindowWriteString(helpw, "Prev  Entry - ", 11, 0);
  82.   WindowWriteCenterString(helpw, "Press any key...", 13);
  83. }
  84.  
  85.  
  86. int show_help(FORMPTR form, int entry, int *newent)
  87. {
  88.   int which;
  89.   WindowDisplay(helpw, 1, EXPLODE);
  90.   GET_MPRESS_KEY(&which);
  91.   WindowHide(helpw, CONTRACT);
  92.   if (entry != 7)
  93.     *newent = prev_field;
  94.   else
  95.     *newent = entry;
  96.   return FIELD_NEWFIELD;
  97. }
  98.