home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / editctls / simple / simple.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.4 KB  |  49 lines

  1. //************************************************************
  2. // Edit Controls - Simple Edit Example
  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 <iapp.hpp>
  9. #include <ientryfd.hpp>
  10. #include <iframe.hpp>
  11. #include <imcelcv.hpp>
  12. #include <imle.hpp>
  13. #include <istring.hpp>
  14.  
  15. void main()
  16. {
  17.   // Create the frame, client canvas and edit controls.
  18.   IFrameWindow aFrame( "Simple edit example" );
  19.   IMultiCellCanvas aClient( 1000, &aFrame, &aFrame );
  20.   IEntryField myEntryField( 1001, &aClient, &aClient );
  21.   IMultiLineEdit myMLE( 1002, &aClient, &aClient );
  22.  
  23.   // Add the edit controls to the canvas.
  24.   aClient
  25.    .addToCell( &myEntryField, 2, 2 )
  26.    .addToCell( &myMLE,        2, 4 );
  27.  
  28.   // Set the text of the entry field.
  29.   myEntryField.setText( "Common Text Operations" );
  30.  
  31.   // Query the text of the entry field.
  32.   IString text = myEntryField.text();
  33.  
  34.   // Find the length of the text in the entry field.
  35.   int length = myEntryField.textLength();
  36.  
  37.   // Now apply the same functions to an MLE.
  38.   myMLE.setText( "Common Text Operations" );
  39.   text = myMLE.text();
  40.   length = myMLE.textLength();
  41.  
  42.   aFrame
  43.     .setClient( &aClient )
  44.     .setFocus()
  45.     .show();
  46.   IApplication::current().run();
  47. }
  48.  
  49.