[comp.windows.interviews] Adding VHScroller to a StringBrowser

janc@HPLDS3.SID.HP.COM (Jan Chang) (05/15/91)

   Environment:
     IV2.6 on HP800 running C++ 2.1

   I am trying to add both vertical and horizontal scroller bars to
a stringbrowser (Option A).  It appears OK but the horizontal 
scroller bars does not work.  If I insert the stringbrowser into a 
viewport (Option B) and AddVHScroller(viewport), then the viewport 
only displays number of rows (NUM_ROWS) specified in the stringbrowser 
constructor, even though I have more NUM_ROWS to be displayed.  

Can someone tell me what is my problem?

Thanks,
Jan
******************************************************************
*  This is my function to add both vertical and horizontal scroller
********************************************************************
//
// Add both horizontal and vertical scroll bar 
// INPUTS:
//   i:   Any kind of interactors.
//
// RETURN:
//   an Interactor.
Interactor* GenMonoScene::AddVHScroller(Interactor* i)
{
   HBox *_hbox;

   _hbox = new HBox
   (
      new MarginFrame(i, 2),
      new VBorder,
      new VBox
      (
         new UpMover(i, 1),
         new HBorder,
         new VScroller(i),
         new HBorder,
         new DownMover(i, 1)
      )
   );
   return new VBox
   (
      _hbox,
      new HBorder,
      new HBox
      (
         new LeftMover(i, 1),
         new VBorder,
         new HScroller(i),
         new VBorder,
         new RightMover(i, 1)
       )
    );
}

******************************************************************
*Option A:
*  Add VHScroller to the stringbrowser
********************************************************************

_strbr = new StringBrowser(_strbr_bs, 20, 60, false);

// Put the stringbrowser into a HBox
strbr_hbox = new HBox(
                        new HGlue(round(0.3*inch),0),
                        new Frame(AddVHScroller(_strbr),
                        new HGlue
                      );

********************************************************************
*Option B:
*  Add VHScroller to a viewport         
********************************************************************

_strbr = new StringBrowser(_strbr_bs, 20, 60, false);

// Add stringbrowser to viewport
_viewport = new Viewport(_strbr,Top);

// Put the stringbrowser into a HBox
strbr_hbox = new HBox(
                        new HGlue(round(0.3*inch),0),
                        new Frame(AddVHScroller(_viewport),
                        new HGlue
                      );
********************************************************************