home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / MASTER-2.ZIP / DLGDSNC / DLGDSNC.LZH / TESTCASE.CPP < prev   
C/C++ Source or Header  |  1991-11-08  |  2KB  |  99 lines

  1.  
  2. #define Uses_TEventQueue
  3. #define Uses_TEvent
  4. #define Uses_TProgram
  5. #define Uses_TApplication
  6. #define Uses_TKeys
  7. #define Uses_TRect
  8. #define Uses_TMenuBar
  9. #define Uses_TSubMenu
  10. #define Uses_TMenuItem
  11. #define Uses_TStatusLine
  12. #define Uses_TStatusItem
  13. #define Uses_TStatusDef
  14. #define Uses_TDeskTop
  15. #define Uses_TView
  16. #define Uses_TWindow
  17. #define Uses_TFrame
  18. #define Uses_TScroller
  19. #define Uses_TScrollBar
  20. #define Uses_TDialog
  21. #define Uses_TButton
  22. #define Uses_TSItem
  23. #define Uses_TCheckBoxes
  24. #define Uses_TRadioButtons
  25. #define Uses_TLabel
  26. #define Uses_TInputLine
  27. #define Uses_TCollection
  28. #define Uses_THistory
  29. #define Uses_TListBox
  30. #define Uses_TStringCollection
  31. #include <tv.h>
  32.  
  33. const cmTry = 150;
  34.  
  35. struct TListboxRec
  36. {
  37.     TCollection* collection;
  38.     short focused;
  39. };
  40.  
  41. class TMyApp : public TApplication
  42. {
  43. public:
  44.     TMyApp();
  45.     static TStatusLine *initStatusLine(TRect r);
  46.     virtual void handleEvent(TEvent& event);
  47. };
  48.  
  49. TMyApp::TMyApp() :
  50.     TProgInit( &TMyApp::initStatusLine,
  51.            &TMyApp::initMenuBar,
  52.            &TMyApp::initDeskTop
  53.          )
  54. {
  55. }
  56.  
  57. TStatusLine *TMyApp::initStatusLine( TRect r )
  58. {
  59.     r.a.y = r.b.y - 1;     // move top to 1 line above bottom
  60.     return new TStatusLine( r,
  61.       *new TStatusDef(0, 0xFFFF) +
  62.       *new TStatusItem("~Alt-X~ Exit", kbAltX, cmQuit) +
  63.       *new TStatusItem("~F9~ Try dialog", kbF9, cmTry)
  64.     );
  65. }
  66.  
  67. //******Insert makeDialog here*****
  68.  
  69.  
  70. dataRec a;
  71.  
  72. void TMyApp::handleEvent(TEvent& event)
  73. {
  74.     TApplication::handleEvent(event);
  75.     if( event.what == evCommand && event.message.command == cmTry )
  76.     {
  77.      TDialog* dialog = makeDialog();
  78.      if (validView(dialog))
  79.        {
  80.        //the line below removes any initialization in makeDialog, so
  81.        //it may be desirable to remove it.
  82.        dialog->setData(&a);
  83.        if (deskTop->execView(dialog) != cmCancel)
  84.           dialog->getData(&a);
  85.        destroy(dialog);
  86.        }
  87.      clearEvent(event);
  88.     }
  89. }
  90.  
  91. int main()
  92. {
  93.     TMyApp myApp;
  94.     myApp.run();
  95.     return 0;
  96. }
  97.  
  98.  
  99.