#: 119416 S5/IBM C++Class
    23-Nov-94  15:17:46
Sb: Spin Button Docu
Fm: HIROSHI TSUJI [IBM] 73232,2467
To: Bob Meizlik 72074,3272

Bob:

Below is a simple example of a text and numeric spin button.

Hiroshi Tsuji  IBM User Interface Library development - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
 // spinbt.cpp
 #include <iapp.hpp>
 #include <iframe.hpp>
 #include <imcelcv.hpp>
 #include <ispinbt.hpp>
 #include <istattxt.hpp>

 void main ( )
 {
   // Create the frame and client windows.
   IFrameWindow frame( "Simple Read-Only Spin Buttons" );
   IMultiCellCanvas client( 0x8008, &frame, &frame );
   frame.setClient( &client );

   // Create some prompt text.
   IStaticText
     prompt1( 1, &client, &client ),
     prompt2( 2, &client, &client );
   prompt1.setText( "Text spin button (hex 00 - 1F)" );
   prompt2.setText( "Numeric spin button (0 - 31)" );

   // Create the spin buttons.
   ISpinButton
     textSpin   ( 3, &client, &client ),
     numericSpin( 4, &client, &client );
   textSpin
    .setReadOnly()
    .enableTabStop()
    .enableGroup();
   numericSpin
    .setInputType( ISpinButton::numeric )
    .setReadOnly()
    .enableTabStop()
    .enableGroup();

   // Fill the text spin button with 00-1F.
   ISpinButton::Cursor cursor( textSpin );
   cursor.setToFirst();
   for( int i = 0; i <= 31; i++ )
   {
      textSpin.addAsLast( IString( i ).d2x(), cursor );
      cursor.setToNext();
   }
   textSpin
    .refreshText()
    .setLimit( 2 );

   // Fill the numeric spin button with 0-31.
   numericSpin
    .setRange( IRange( 0, 31 ))
    .setLimit( 2 );

   // Position the text and spin buttons in the canvas.
   client
    .addToCell( &prompt1,     2, 2 )
    .addToCell( &textSpin,    2, 4 )
    .addToCell( &prompt2,     4, 2 )
    .addToCell( &numericSpin, 4, 4 );

   // Add margins and specify where to add white space.
   unsigned long defaultHeight =
     IMultiCellCanvas::defaultCell().height();
   client
    .setColumnWidth( 2, 1, true )
    .setColumnWidth( 4, 1, true )
    .setColumnWidth( 5, IMultiCellCanvas::defaultCell().width() )
    .setRowHeight( 1, defaultHeight * 2, true )
    .setRowHeight( 3, defaultHeight, true )
    .setRowHeight( 5, defaultHeight * 2, true );

   // Show the window now.
   frame
    .moveSizeToClient( IRectangle( IPoint( 50, 50 ),
                                   client.minimumSize() ))
    .setFocus()
    .show();
   IApplication::current().run();
 }
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ## Make file for spin button example.

 CFLAGS = /Tdp /Gd+ /Ge+ /Gm+ /Wall+ext-gnr-got-por-ppt-uni-vft-
 LFLAGS = /PM:PM /NOI
 LIBS = dde4muii.lib dde4cci.lib

 ALL : spinbt.exe

 spinbt.exe : spinbt.obj
    icc $(CFLAGS) /B"$(LFLAGS)" /Fe.\$*.exe $(LIBS) spinbt.obj

 {.}.cpp.obj:
    icc $(CFLAGS) /C+ .\$*.cpp



