home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pwrgu2.zip / POWERGU2.EXE / CANVAS / CVTAB / CVTAB.CPP next >
Text File  |  1995-07-25  |  2KB  |  74 lines

  1. /*************************************************************/
  2. /* Nested canvas tabbing example.                            */
  3. /*                                                           */
  4. /* Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.       */
  5. /* All Rights Reserved.                                      */
  6. /*************************************************************/
  7. #include <icanvas.hpp>
  8. #include <icolor.hpp>
  9. #include <ientryfd.hpp>
  10. #include <iframe.hpp>
  11. #include <iapp.hpp>
  12. #include <ipushbut.hpp>
  13. #include <isysmenu.hpp>
  14. #include <icconst.h>
  15.  
  16. void main ( )
  17. {
  18.   IFrameWindow frame( "Canvas Tabbing" );
  19.   ICanvas client( IC_FRAME_CLIENT_ID, &frame, &frame );
  20.   frame.setClient( &client );
  21.  
  22.   // Create child windows of the client canvas.
  23.   IEntryField ef1( 1, &client, &client,
  24.                    IRectangle( IPoint( 40, 200 ),
  25.                                ISize( 225, 25 )));
  26.   ef1.setText( "Has tab stop" )
  27.      .enableTabStop()
  28.      .enableGroup();
  29.  
  30.   ICanvas childCanvas( 0, &client, &client,
  31.                        IRectangle( IPoint( 15, 100 ),
  32.                                    ISize( 275, 90 )));
  33.   childCanvas.setColor( ICanvas::background, IColor::cyan );
  34.  
  35.   // Create child windows of the child canvas.
  36.   IEntryField ef2( 2, &childCanvas, &childCanvas,
  37.                    IRectangle( IPoint( 25, 55 ),
  38.                                ISize( 225, 25 )));
  39.   ef2.setText( "Has tab stop" )
  40.      .enableTabStop()
  41.      .enableGroup();
  42.  
  43.   IEntryField ef3( 3, &childCanvas, &childCanvas,
  44.                    IRectangle( IPoint( 25, 10 ),
  45.                                ISize( 225, 25 )));
  46.   ef3.setText( "Has tab stop" )
  47.      .enableTabStop()
  48.      .enableGroup();
  49.  
  50.   // Create another child window of the client canvas.
  51.   IEntryField ef4( 4, &client, &client,
  52.                    IRectangle( IPoint( 40, 65 ),
  53.                                ISize( 225, 25 )));
  54.   ef4.setText( "Has tab stop" )
  55.      .enableTabStop()
  56.      .enableGroup();
  57.  
  58.   // Create a push button.
  59.   IPushButton ok( ISystemMenu::idClose, &client, &client,
  60.                   IRectangle( IPoint( 40, 10 ),
  61.                               ISize( 100, 30 )));
  62.   ok.enableSystemCommand()   // For ISystemMenu::idClose.
  63.     .enableDefault()
  64.     .setText( "OK" )
  65.     .enableTabStop()
  66.     .enableGroup();
  67.  
  68.   // Size and show the window now.
  69.   frame.sizeTo( ISize( 310, 280 ))
  70.        .setFocus()
  71.        .show();
  72.   IApplication::current().run();
  73. }
  74.