home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / cnr / edithdr / edithdr.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.4 KB  |  58 lines

  1. //************************************************************
  2. // Container - Keyboard Handler for MLE
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //************************************************************
  8. #include <iframe.hpp>
  9. #include <iapp.hpp>
  10. #include <icnrctl.hpp>
  11. #include <icnrobj.hpp>
  12. #include <icnrhdr.hpp>
  13. #include <icnrehdr.hpp>
  14. #include <icconst.h>
  15.  
  16. #include "keyhdr.hpp"
  17.  
  18. void main()
  19. {
  20. // Create the frame and a container.
  21. IFrameWindow frame("Container Keyboard Edit Handler");
  22. IContainerControl cnr(IC_FRAME_CLIENT_ID, &frame, &frame);
  23.  
  24. // Create and attach the container handlers.
  25. ICnrEditHandler editHandler;
  26. ICnrHandler cnrHandler;
  27. editHandler.handleEventsFor(&cnr);
  28. cnrHandler.handleEventsFor(&cnr);
  29.  
  30. // Create the keyboard handler and pass it to
  31. // the container's edit handler to use whenever
  32. // an MLE is created.
  33. KeyboardHandler keyHandler;
  34. editHandler.setMLEHandler(&keyHandler);
  35.  
  36. // Add an object for editing.
  37. IContainerObject* object;
  38. object = new IContainerObject("Object 1");
  39. cnr
  40.   .addObject(object)
  41.   .enableDataUpdate(object);
  42.  
  43. // Put the container into the text view and
  44. // give it the focus.
  45. cnr
  46.   .showTextView()
  47.   .setFocus();
  48.  
  49. // Put the container in the client and
  50. // show the frame.
  51. frame
  52.  .setClient(&cnr)
  53.  .show();
  54.  
  55. // Start processing messages.
  56. IApplication::current().run();
  57. }
  58.