# BetterScrollView

Derived from: public BScrollView

Declared in: BetterScrollView.h

Library: none

## Overview

BetterScrollView is a BScrollView-derived class which derives most of its functionality from BScrollView, so for the most part, see the BScrollView documentation for how to use this class. BetterScrollView adds the notion of a data rect, which represents what the BetterScrollView is looking at. BetterScrollView handles setting up the scroll bars to reflect the size of that data, and provides a nice "pulling reveal" behavior during resizing when looking at the bottom and/or right side of the data rect.

## Constructor and Destructor

### BetterScrollView()

          BetterScrollView(const char *name, BView *target, uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
                uint32 flags = B_FRAME_EVENTS | B_WILL_DRAW, bool horizontal = true, bool vertical = true,
                bool scroll_view_corner = true, border_style border = B_FANCY_BORDER)

Creates a BetterScrollView large enough to enclose the target view, with the requested scroll bars and border style. If horizontal is true, a horizontal scroll bar is created. If vertical is true, a vertical scroll bar is created. If scroll_view_corner is true, a small filler view is created inbetween the horizontal and vertical scroll bars, in the lower right corner (don't do this if the BetterScrollView is in a B_DOCUMENT_WINDOW, and is seated against the lower right hand corner, where the resize handle is; otherwise, you should probably specify scroll_view_corner to be true.

### ~BetterScrollView()

          virtual ~BetterScrollView()

Destroys the BetterScrollView and frees all memory associated with it.

## Member Functions

### Archive()

          virtual status_t Archive(BMessage *archive, bool deep = true) const

Currently not implemented. It isn't high on my priorities, since archival is not something I'm making use of. If someone needs this functionality and fills it in, please send me the modified code so that others can benefit from it.

See also: `BArchivable::Archive()`, `Instantiate()` static function

### AttachedToWindow()

          virtual void AttachedToWindow()

Updates the scroll bars, since BeOS will alter them in `BTextView::AttachedToWindow()` for some reason.

See also: `BView::AttachedToWindow()`, `BTextView::AttachedToWindow()`

### FrameResized()

          virtual void FrameResized(float new_width, float new_height)

Responds to frame events by updating the scroll bars to reflect how much of the data rect is displayed. If the user is looking at the lower and/or right side of the data rect, it will pull the contents to reveal more at the top. If the user resizes the view to be larger than the data rect, it stops pulling with the top and/or left side of the data rect at the top and/or left side of the view.

See also: `BView::FrameResized()`

### SetDataRect(), DataRect()

          virtual void SetDataRect(BRect data_rect, bool scrolling_allowed = true)
          BRect DataRect()

Set or return the data rect used to determine the scroll bar handles' size and position.

By Brian Tietz

Copyright 2000

Bug reports (including documentation errors) and feature requests can be sent to briant@timelinevista.com.