home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / uidemo / textedit / appwin.cxx next >
C/C++ Source or Header  |  1995-04-08  |  955b  |  38 lines

  1.  
  2.  
  3.  
  4. #include "ui/applic.h"
  5. #include "ui/stddlg.h"
  6.  
  7. #include "appwin.h"
  8. #include <fstream.h>
  9.  
  10. #define ID_BUTTON 101
  11.  
  12. AppWindow::AppWindow ()
  13. : UI_CompositeVObject (NULL, (UI_ViewDescriptor*) NULL, FALSE,
  14.                        UI_Rectangle (50, 50, 310, 250))
  15. {
  16.     _btn   = new UI_PushButton (this, UI_Rectangle (120, 210,  60, 30),
  17.                                 ID_BUTTON);
  18.     _edit  = new UI_TextEditor (this, UI_Rectangle (  5,   5, 300, 200));
  19.     
  20.     _btn->Title () = "Save";
  21.     (CL_String&) _edit->Model() = "What you type here will be saved"
  22.         " in junk.dat";
  23. }
  24.  
  25. bool AppWindow::HandleChildEvent (const UI_Event& e)
  26. {
  27.     if (e.Type() != Event_Select || e.Origin() != _btn)
  28.         return FALSE;
  29.     CL_String msg = "Selection: " + _edit->Selection().AsString();
  30.     UI_SimpleDialog (msg);
  31.     ofstream f ("junk.dat");
  32.     f << (_edit->Model());
  33.     _Application->Destroy (this);
  34.     return TRUE;
  35. }
  36.  
  37.  
  38.