KwikPeg Manuals
Home
PegHScroll
Examples
Examples
Index
Index


Members
Styles
(none)
Signals
Overview Derived from class PegThing

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

The PegHScroll scroll bar takes two forms. The most common form is a non-client area scroll bar. In this form, PegHScroll calls the parent window's GetHScrollInfo() function to determine scroll bar position, size and limit information. An instance of this form of PegHScroll 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 PegHScroll 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)

PegVScroll

PegSlider



 Signals

The PegHScroll 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 PegHScroll object.
 

Top of page


 Members

Constructors:

PegHScroll(void)

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

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

This constructor creates a client area PegHScroll 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 PegHScroll 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 PegHScroll 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 PegHScroll 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 PegHScroll 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 width of the scroll bar elevator will be 25% of the width of the entire scroll bar.

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

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

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

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



Top of page
KwikPeg Manuals
Home
Index
Index

 
Copyright © 2000-2003