KwikPeg Manuals
Home
PegVScroll
Examples
Examples
Index
Index


Members
Styles
(none)
Signals
Overview Derived from class PegThing

The PegVScroll class provides vertical scroll bars. The scroll bar elevator is proportional to the visible area of the object being scrolled.

The PegVScroll scroll bar takes two forms. The most common form is a non-client area scroll bar. In this form, PegVScroll calls the parent window's GetVScrollInfo() function to determine scroll bar position, size and limit information. An instance of this form of PegVScroll scroll bar has PSF_NONCLIENT system status.

The second form is a client area scroll bar. This form does not have PSF_NONCLIENT system status. A client area scroll bar controls its own position and operation. It does not attempt to automatically determine position and limit information from its parent.

Client area PegVScroll objects are very similar in operation to PegSlider objects. They are useful for allowing the end user to update a field on the display by dragging the scroll elevator or selecting the directional scroll buttons.



 See Also

How Scrolling Works

Scroll Structure (PegScrollInfo)

PegHScroll

PegSlider



 Signals

The PegVScroll class generates the following signals:

PSF_SCROLL_CHANGE Sent by non-client PegHScroll and PegVScroll derived objects when scroll bar changes occur.
 
The signal message contains the following information:
 
Message.lData  Current scroll position.
Message.iData  Last reported scroll position.
Message.pSource  Pointer to PegVScroll object.
 

Top of page


 Members

Constructors:

PegVScroll(void)

This constructor creates a non-client area scroll bar. The scroll bar will automatically determine its position and size itself to the height of the parent window's client area.

PegVScroll(const PegRect &InRect,
  PegScrollInfo *si, WORD wId = 0)

This constructor creates a client area PegVScroll scroll bar at a specific location within a rectangle specified by parameter Rect. Parameter si is a pointer to a PegScrollInfo scroll information structure which defines the initial scrolling range and elevator position. Parameter wId provides an optional scroll bar ID.

 

Public Functions:

virtual void Draw(void)

The PegVScroll class overrides the Draw() function to fill the scroll bar background area.

PegScrollInfo *GetScrollInfo(void)
  {return &mScrollInfo;}

This inline function can be called to retrieve the current scroll bar information.

virtual SIGNED Message(const PegMessage &Mesg)

The PegVScroll class catches PM_SHOW, directional button selection and elevator drag messages.

void Reset(void)
void Reset(PegScrollInfo *si)

These functions allow the scroll bar position to be recalculated or reset at any time. The first form is used with non-client scroll bars. The second form is used with client-area scroll bars that are under program control.

void Resize(PegRect Rect)

The PegVScroll class overrides the Resize() function to ensure that the elevator remains proportional to the overall scroll bar size. 


Top of page


 Examples

The following examples illustrate PegVScroll objects:



The following example initializes a PegScrollInfo structure and creates a client area scroll bar. The scroll bar will report values between 0 and 200 and will initially be positioned at 100, the halfway point. The height of the scroll bar elevator will be 25% of the height of the entire scroll bar.

void MyWindow::AddVScroll(void)
{
    PegScrollInfo si;

    si.wMin = 0;
    si.wMax = 200;
    si.wCurrent = 100;
    si.wStep = 1;
    si.wVisible = 50;

    PegRect ScrollRect;
    ScrollRect.Set(10, 10, PEG_SCROLL_WIDTH + 10, 80);

    Add(new PegVScroll(ScrollRect, &si));
}



Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003