Home |
HMI (Human-Machine Interface) Classes Class PegLinearScale |
Class PegLinearScalePegLinearScale is an output HMI gadget that facilitates a graphical representation of any given value in relation to a minimum and maximum value. This particular scale is the output equivalent of PegSlider. Style FlagsPegLinearScale supports the standard PegThingstyles for borders: FF_NONE, FF_THIN, FF_RECESSED and FF_RAISED. See the PegScale Styles section for a detailed list of additional styles. SignalsPegLinearScale does not send any signals. class PegLinearScale : public PegScale { public: PegLinearScale(const PegRect &Size, LONG lMinValue, LONG lMaxValue, LONG lTicFreq = 0, PEGUINT wStyle = SS_STANDARDSTYLE | FF_RAISED); PegLinearScale(PEGINT iLeft, PEGINT iTop, LONG lMinValue, LONG lMaxValue, LONG lTicFreq = 0, PEGUINT wStyle = SS_STANDARDSTYLE | FF_RAISED); virtual void Draw(void); LONG GetTicFreq(void) const; void SetTicFreq(LONG lFreq); protected: virtual void DrawScale(void); virtual void DrawTicMarks(void); LONG mlTicFreq; }; ConstructorsThe first constructor takes a reference to a PegRect to determine its size, a typical wStyle PEGUINT, a minimum value and a maximum value. The last parameter, lTicFreq, determines the frequency at which tick marks are drawn on the scale. For instance, if this is set to 100, and the minimum value is set to 0 and the maximum value is set to 1000, then PegLinearScale will draw a tick mark at every 100 data value increments starting with 0 and continuing up to 1000, making a total of 11 tick marks. It is important to remember that this value is in the context of the data value, not in screen pixels. The second constructor takes PEGINT values for the left and top pixel designations of the object. By default, this will construct a PegLinearScale object with a width of 100 pixels and a height of 150 pixels. The remaining parameters are the same as the constructor above. Method DrawPegLinearScale overrides the Draw() function to draw the scale and the tick marks, if any. Method GetTicFreqThis inline method returns the current tick mark frequency. Method SetTicFreqThis method allows for the setting of the interval at which the tick marks will be drawn. ExamplesBelow is an example of several PegLinearScale objects on a PegDecoratedWindow. The code snippet which follows builds the first PegLinearScale in the top left corner of the example window. PegLinearScale * mpScale1; . . PegRect WinRect; WinRect.Set(50, 50, 100, 200); mpScale1 = new PegLinearScale(WinRect, AF_TRANSPARENT | SS_STANDARDSTYLE, 0, 100, 10); Add(mpScale1);
|