home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / samples / sample18 / sample18.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-16  |  1.6 KB  |  62 lines

  1. #define INCL_OOL_WIN
  2. #include "ool.h"
  3.  
  4. class View1Window: public XModelessDailog
  5. {
  6.    public:
  7.       void DoControl( XControlEvent * event);
  8. }
  9.  
  10.  
  11. View1Window :: View1Window( ): XModelessDialog( IDM_MAIN )//, "Sample8 - DDEServer", XFrameWindow::defaultDialogStyle | FRM_TASKLIST | FRM_CENTER, NULL, NULL, TRUE)
  12. {
  13.    Show();
  14.  
  15.    SetText("DDEServer - not connected");
  16.    dde = new MyDDE(this );
  17.    Activate();
  18. }
  19.  
  20.  
  21. void View1Window :: DoControl( XControlEvent * event)
  22. {
  23.  
  24.    if( event->GetEventID() == WIN_KILLFOCUS)
  25.       {
  26.          char * item = NULL;
  27.          switch( event->GetWindowID() )
  28.             {
  29.                case ENTRY_ONE:
  30.                   item = "FIELD1";
  31.                   break;
  32.                case ENTRY_TWO:
  33.                   item = "FIELD2";
  34.                   break;
  35.                case ENTRY_THREE:
  36.                   item = "FIELD3";
  37.                   break;
  38.                case ENTRY_FOUR:
  39.                   item = "FIELD4";
  40.                   break;
  41.             }
  42.          if( item) //dde->IsConnected() &&
  43.             {
  44.                XString data;
  45.                event->GetWindow()->GetText( &data );
  46.                SHORT i;
  47.                for(i=0; i < dde->clientCount; i++)
  48.                   {
  49.                      if( dde->clients[i] != 0)
  50.                         dde->SendData( dde->clients[i], item, (char*) data, data.GetLength() + 1, 0);
  51.                   }
  52.             }
  53.       }
  54. }
  55.  
  56.  
  57. void main ( void)
  58. {
  59.    View1Window * window = new View1Window();   //create new framewindow (see above)
  60.    XApplication::GetApplication()->Start();    //let the application work
  61. }
  62.