home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / yacl-012.zip / uidemo / combobox / appwin.cxx next >
C/C++ Source or Header  |  1995-02-23  |  1KB  |  43 lines

  1.  
  2. #include "appwin.h"
  3. #include "ui/stddlg.h"
  4. #include "ui/applic.h"
  5.  
  6.  
  7. #define ID_BUTTON 10
  8. #define ID_LABEL  11
  9. #define ID_BOX    12
  10.  
  11.  
  12. AppWindow::AppWindow()
  13. : UI_Dialog (NULL, NULL, UI_Rectangle (40, 40, 400, 300))
  14. {
  15.     _btn   = new UI_PushButton (this, UI_Rectangle (95, 200, 75, 30),
  16.                                 ID_BUTTON);
  17.     _lbl   = new UI_Label    (this, UI_Rectangle (55, 50, 245, 20),  ID_LABEL);
  18.     _box   = new UI_ComboBox (this, UI_Rectangle (55, 90, 245, 100), ID_BOX,
  19.                               FALSE);
  20.  
  21.     UI_StringSequence& model = (UI_StringSequence&) _box->Model();
  22.     model.Add ("Word for Windows");
  23.     model.Add ("WordPerfect");
  24.     model.Add ("Freelance");
  25.     model.Add ("PowerPoint");
  26.     model.Add ("CorelDraw!");
  27.     model.Add ("PC Anywhere");
  28.     model.Add ("Carbon Copy");
  29.     _btn->Title() = "Show";
  30.     _title = "YACL ComboBox Demo";
  31. }
  32.  
  33. bool AppWindow::HandleChildEvent (const UI_Event& e)
  34. {
  35.     if (e.Origin() == _btn && e.Type() == Event_Select) {
  36.         _lbl->Title() = "Selection: '" + _box->EditString() + "'";
  37.         return TRUE;
  38.     }
  39.     return FALSE;
  40. }
  41.  
  42.  
  43.