Home |
Class PegVScroll HMI (Human-Machine Interface) Classes |
Class PegVScrollPegVScroll is a horizontal scroll bar class. The scroll bar elevator is proportional to the visible area of the object being scrolled. PegVScroll takes two forms. The most common form is a NONCLIENT area scroll bar. In this form PegVScroll calls the parent window GetHScrollInfo function to determine position, size, and limit information. An instance of this form of PegVScroll has PSF_NONCLIENT system status. The second form is a client area scroll bar. This form does not have PSF_NONCLIENT system status. This type of scroll bar is under system software control, and does not attempt to automatically determine position and limit information. Client area PegVScroll objects are very similar in operation to PegSlider objects. They are useful for allowing the user to update a field on the display by dragging the scroll elevator or selecting the directional scrolling buttons. struct PegScrollInfo { int wMin; int wMax; int wCurrent; int wStep; int wVisible; }; class PegVScroll : public PegThing { public: PegVScroll(void); PegVScroll(const PegRect &InRect, PegScrollInfo * Info, PEGUINT wId = 0); virtual PEGINT Message(const PegMessage &Mesg); virtual void Draw(void); PegScrollInfo * GetScrollInfo(void) void Reset(void); void Reset(PegScrollInfo * Info); void Resize(PegRect Rect); }; SignalsPegVScroll sends PSF_SCROLL_CHANGE signals when the position of the scroll bar elevator is changed either by dragging the elevator or by selecting the directional scroll buttons. lData is the current scroll position. iData has the last reported scroll position. pSource pointers to PegVScroll object. ConstructorsThe first 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. The second constructor creates a client area scroll bar. In this mode, a pointer to a PegScrollInfo structure is passed to setup the initial scrolling range. In this mode the scroll bar position and size are passed to the constructor, along with the scroll bar ID, if any. Method DrawPegVScroll overrides the Draw() function to fill the scroll bar background area. Method GetScrollInfoRetrieves the current scroll bar information. Method MessagePegVScroll catches PM_SHOW, directional button selection and elevator drag messages. Method ResetRecalculates or resets the scroll bar position. The first form is used with non-client scroll bars, and the second form is used with client-area scroll bars that are under program control. Method ResizePegVScroll overrides the Resize() function to insure that the elevator remains proportional to the overall scroll bar size. Examples:The following are examples of PegVScroll: The following example initializes a PegScrollInfo structure and creates a client area scroll bar. The scroll bar will report values between 0 and 200, will initially be positioned at 100, and the scroll bar elevator will be 25% as high as the 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)); }
|