home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / tvision / mess1 / dialog.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-31  |  3.1 KB  |  133 lines

  1. //========================================================================
  2. //  The following example routines have been provided by the Technical
  3. //  Support staff at Borland International.  They are provided as a
  4. //  courtesy and not as part of a Borland product, and as such, are
  5. //  provided without the assurance of technical support or any specific
  6. //  guarantees.
  7. //========================================================================
  8. //  Turbo Vision - Example of message passing
  9. //
  10. //------------------------------------------------------------------------
  11. //
  12. // dialog.cpp:  The member function definition for TDataEntryDlg.
  13. //
  14. //========================================================================
  15.  
  16. #define Uses_TInputLine
  17. #define Uses_TStaticText
  18. #define Uses_TRadioButtons
  19. #define Uses_TCheckBoxes
  20. #define Uses_TSItem
  21. #define Uses_TButton
  22. #define Uses_TKeys
  23. #define Uses_TLabel
  24. #define Uses_THistory
  25. #include <tv.h>
  26. #include "dialog.h"
  27. #include "cmds.h"
  28.  
  29.  
  30. //
  31. // TDataEntryDlg - Constructor
  32. //
  33.  
  34. TDataEntryDlg::TDataEntryDlg(TRect bounds,char *aTitle) :
  35.     TDialog(bounds,aTitle),
  36.     TWindowInit(&TDataEntryDlg::initFrame)
  37. {
  38.     TInputLine *pn,*pe;
  39.     TRadioButtons *pr;
  40.     TCheckBoxes *pc;
  41.  
  42.     // Lesson E.3 //
  43.  
  44.     isValid = True;
  45.  
  46.  
  47.     insert(pn = new TInputLine(TRect(5,2,28,3),21));
  48.  
  49.  
  50.  
  51.     // Lesson E.3 //
  52.  
  53.     if (!pn)
  54.     {
  55.         isValid = False;
  56.     }
  57.  
  58.  
  59.     // Lesson E.2 //
  60.     insert(new TLabel(TRect(14,1,19,2),"~N~ame",pn));
  61.     insert(new THistory(TRect(28,2,31,3),pn,nameHistoryId));
  62.  
  63.     insert(pe = new TInputLine(TRect(39,2,46,3),5));
  64.  
  65.  
  66.     // Lesson E.3 //
  67.  
  68.     if (!pe)
  69.     {
  70.         isValid = False;
  71.     }
  72.  
  73.  
  74.     insert(new TLabel(TRect(40,1,44,2),"~E~xt",pe));
  75.     insert(new THistory(TRect(46,2,49,3),pe,extHistoryId));
  76.  
  77.     insert(pr = new TRadioButtons(TRect(2, 5, 18, 11),
  78.         new TSItem( "~B~ix",
  79.         new TSItem( "~C~ompuSlave",
  80.         new TSItem( "~G~enie",
  81.         new TSItem( "~I~BBS",
  82.         new TSItem( "~L~etters",
  83.         new TSItem( "~T~raining",
  84.         0))))))));
  85.  
  86.  
  87.     if (!pr)
  88.     {
  89.         isValid = False;
  90.     }
  91.  
  92.  
  93.     insert(new TLabel(TRect(5,4,15,5),"~B~BS Duties",pr));
  94.  
  95.     insert(pc = new TCheckBoxes(TRect(22, 5, 54, 11),
  96.         new TSItem("~A~ssembly",
  97.         new TSItem("~B~asic",
  98.         new TSItem("~C~++",
  99.         new TSItem("~D~ebugger",
  100.         new TSItem("D~O~S",
  101.         new TSItem("~E~ngine",
  102.         new TSItem("~L~etters",
  103.         new TSItem("OS~2~",
  104.         new TSItem("O~W~L",
  105.         new TSItem("~P~rofiler",
  106.         new TSItem("~T~V",
  107.         new TSItem("W~i~ndows",
  108.         0))))))))))))));
  109.  
  110.  
  111.     if (!pc)
  112.     {
  113.         isValid = False;
  114.     }
  115.  
  116.  
  117.     insert(new TLabel(TRect(33,4,43,5),"~I~nterests",pc));
  118.  
  119.     insert(new TButton(TRect(7, 12, 23, 16), "~C~ancel", cmCancel, bfNormal));
  120.     insert(new TButton(TRect(34, 12, 50, 16), "~S~ave", cmOK, bfDefault));
  121.     selectNext(False);
  122. }
  123.  
  124.  
  125. //
  126. // valid - Returns the state of an instance of TDataEntryDlg.
  127. //
  128.  
  129. Boolean TDataEntryDlg::valid(ushort)
  130. {
  131.     return (isValid);
  132. }
  133.