home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / maj / 535 / testcase.cpp < prev    next >
C/C++ Source or Header  |  1993-12-19  |  3KB  |  108 lines

  1. /*-------------------------------------------------------------------
  2.                             testcase.cpp
  3.  
  4. A program to test type 1 source code generated by Dialog Design.  Open
  5. project, TEST.PRJ, copy this file to TEST.CPP and then insert the XXX.SRC
  6. file generated by Dialog Design at the line of asterisks.  Choose
  7. Compile\Make (F9) to form the test program TEST.EXE.
  8.  
  9. In case of difficulty, check Options|Directories to make sure the directory
  10. paths are correct for your system.
  11.  
  12. --------------------------------------------------------------------*/
  13.  
  14. #define Uses_TEventQueue
  15. #define Uses_TEvent
  16. #define Uses_TProgram
  17. #define Uses_TApplication
  18. #define Uses_TKeys
  19. #define Uses_TRect
  20. #define Uses_TMenuBar
  21. #define Uses_TSubMenu
  22. #define Uses_TMenuItem
  23. #define Uses_TStatusLine
  24. #define Uses_TStatusItem
  25. #define Uses_TStatusDef
  26. #define Uses_TDeskTop
  27. #define Uses_TView
  28. #define Uses_TWindow
  29. #define Uses_TFrame
  30. #define Uses_TScroller
  31. #define Uses_TScrollBar
  32. #define Uses_TDialog
  33. #define Uses_TButton
  34. #define Uses_TSItem
  35. #define Uses_TCheckBoxes
  36. #define Uses_TRadioButtons
  37. #define Uses_TLabel
  38. #define Uses_TInputLine
  39. #define Uses_TCollection
  40. #define Uses_THistory
  41. #define Uses_THistoryWindow
  42. #define Uses_TListBox
  43. #define Uses_TStringCollection
  44. #define Uses_TMemo
  45. #define Uses_TColoredText
  46. #define Uses_TInputLong
  47. #include <tv.h>
  48. #include "tcolortx.h"
  49. #include "tinplong.h"
  50.  
  51. const cmTry = 150;
  52.  
  53. class TMyApp : public TApplication
  54. {
  55. public:
  56.     TMyApp();
  57.     static TStatusLine *initStatusLine(TRect r);
  58.     virtual void handleEvent(TEvent& event);
  59. };
  60.  
  61. TMyApp::TMyApp() :
  62.     TProgInit( TMyApp::initStatusLine,
  63.            TMyApp::initMenuBar,
  64.            TMyApp::initDeskTop
  65.          )
  66. {
  67. }
  68.  
  69. TStatusLine *TMyApp::initStatusLine( TRect r )
  70. {
  71.     r.a.y = r.b.y - 1;     // move top to 1 line above bottom
  72.     return new TStatusLine( r,
  73.       *new TStatusDef(0, 0xFFFF) +
  74.       *new TStatusItem("~Alt-X~ Exit", kbAltX, cmQuit) +
  75.       *new TStatusItem("~F9~ Try dialog", kbF9, cmTry)
  76.     );
  77. }
  78.  
  79. //******Insert makeDialog here*****
  80.  
  81. dataRec a;
  82.  
  83. void TMyApp::handleEvent(TEvent& event)
  84. {
  85.     TApplication::handleEvent(event);
  86.     if( event.what == evCommand && event.message.command == cmTry )
  87.     {
  88.      TDialog* dialog = makeDialog();
  89.      if (validView(dialog))
  90.        {
  91.        dialog->setData(&a);
  92.        if (deskTop->execView(dialog) != cmCancel)
  93.           dialog->getData(&a);
  94.        destroy(dialog);
  95.        }
  96.      clearEvent(event);
  97.     }
  98. }
  99.  
  100. int main()
  101. {
  102.     TMyApp myApp;
  103.     myApp.run();
  104.     return 0;
  105. }
  106.  
  107.  
  108.