library: libGui #include "TGNumberEntry.h"

# TGNumberEntryField

class description - source file - inheritance tree (.pdf)

## class TGNumberEntryField : public TGTextEntry, public TGNumberFormat

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
`TGWidget`
| <- | `TGTextEntry`
`TGNumberFormat`
| <- | `TGNumberEntryField` |

        public:

                                             TGNumberEntryField(const TGWindow* p, Int_t id, Double_t val, GContext_t norm, FontStruct_t font = GetDefaultFontStruct(), UInt_t option = kSunkenFrame|kDoubleBorder, Pixel_t back = GetWhitePixel())
                                             TGNumberEntryField(const TGWindow* parent = 0, Int_t id = -1, Double_t val = 0, TGNumberFormat::EStyle style = kNESReal, TGNumberFormat::EAttribute attr = kNEAAnyNumber, TGNumberFormat::ELimit limits = kNELNoLimits, Double_t min = 0, Double_t max = 1)
                                             TGNumberEntryField(const TGNumberEntryField&)
                                             ~TGNumberEntryField()
                              static TClass* Class()
                               virtual Int_t GetCharWidth(const char* text = "0") const
                                virtual void GetDate(Int_t& year, Int_t& month, Int_t& day) const
                             virtual ULong_t GetHexNumber() const
                              virtual Long_t GetIntNumber() const
          virtual TGNumberFormat::EAttribute GetNumAttr() const
                            virtual Double_t GetNumber() const
              virtual TGNumberFormat::ELimit GetNumLimits() const
                            virtual Double_t GetNumMax() const
                            virtual Double_t GetNumMin() const
              virtual TGNumberFormat::EStyle GetNumStyle() const
                                virtual void GetTime(Int_t& hour, Int_t& min, Int_t& sec) const
                              virtual Bool_t HandleFocusChange(Event_t* event)
                              virtual Bool_t HandleKey(Event_t* event)
                                virtual void IncreaseNumber(TGNumberFormat::EStepSize step = kNSSSmall, Int_t sign = 1, Bool_t logstep = kFALSE)
                             virtual TClass* IsA() const
                              virtual Bool_t IsLogStep() const
                                virtual void Layout()
                                virtual void ReturnPressed()
                                virtual void SetDate(Int_t year, Int_t month, Int_t day)
                                virtual void SetFormat(TGNumberFormat::EStyle style, TGNumberFormat::EAttribute attr = kNEAAnyNumber)
                                virtual void SetHexNumber(ULong_t val)
                                virtual void SetIntNumber(Long_t val)
                                virtual void SetLimits(TGNumberFormat::ELimit limits = kNELNoLimits, Double_t min = 0, Double_t max = 1)
                                virtual void SetLogStep(Bool_t on = kTRUE)
                                virtual void SetNumber(Double_t val)
                                virtual void SetState(Bool_t state)
                                virtual void SetText(const char* text)
                                virtual void SetTime(Int_t hour, Int_t min, Int_t sec)
                                virtual void ShowMembers(TMemberInspector& insp, char* parent)
                                virtual void Streamer(TBuffer& b)
                                        void StreamerNVirtual(TBuffer& b)
                                virtual void TextChanged(const char* text = "0")

### Data Members

        protected:

                              Bool_t fNeedsVerification  Needs verification of input
              TGNumberFormat::EStyle fNumStyle           Number style
          TGNumberFormat::EAttribute fNumAttr            Number attribute
              TGNumberFormat::ELimit fNumLimits          Limit attributes
                            Double_t fNumMin             Lower limit
                            Double_t fNumMax             Upper limit
                              Bool_t fStepLog            Logarithmic steps for increase?

## Class Description

     TGNumberEntry, TGNumberEntryField and TGNumberFormat

     TGNumberEntry is a number entry input widget with up/down buttons.
     TGNumberEntryField is a number entry input widget.
     TGNumberFormat contains enum types to specify the numeric format.

     The number entry widget is based on TGTextEntry but allows only
     numerical input. The widget support numerous formats including
     integers, hex numbers, real numbers, fixed fraction reals and
     time/date formats. The widget also allows to restrict input values
     to non-negative or positive numbers and to specify explicit limits.

     The following styles are supported:
     kNESInteger:        integer number
     kNESRealOne:        real number with one digit (no exponent)
     kNESRealTwo:        real number with two digits (no exponent)
     kNESRealThree:      real number with three digits (no exponent)
     kNESRealFour:       real number with four digits (no exponent)
     kNESReal:           arbitrary real number
     kNESDegree:         angle in degree:minutes:seconds format
     kNESMinSec:         time in minutes:seconds format
     kNESHourMin:        time in hour:minutes format
     kNESHourMinSec:     time in hour:minutes:seconds format
     kNESDayMYear:       date in day/month/year format
     kNESMDayYear:       date in month/day/year format
     kNESHex:            hex number

     The following attributes can be specified:
     kNEAAnyNumber:      any number is allowed
     kNEANonNegative:    only non-negative numbers are allowed
     kNEAPositive:       only positive numbers are allowed

     Explicit limits can be specified individually:
     kNELNoLimits:       no limits
     kNELLimitMin:       lower limit only
     kNELLimitMax        upper limit only
     kNELLimitMinMax     both lower and upper limits

     TGNumberEntryField is a plain vanilla entry field, whereas
     TGNumberEntry adds two small buttons to increase and decrease the
     numerical value in the field. The number entry widgets also support
     using the up and down cursor keys to change the numerical values.
     The step size can be selected with control and shift keys:
     --                  small step (1 unit/factor of 3)
     shift               medium step (10 units/factor of 10)
     control             large step (100 units/factor of 30)
     shift-control       huge step (1000 units/factor of 100)

     The steps are either linear or logarithmic. The default behaviour
     is set when the entry field is created, but it can be changed by
     pressing the alt key at the same time.

     Changing the number in the widget will generate the event:
     kC_TEXTENTRY, kTE_TEXTCHANGED, widget id, 0.
     Hitting the enter key will generate:
     kC_TEXTENTRY, kTE_ENTER, widget id, 0.
     Hitting the tab key will generate:
     kC_TEXTENTRY, kTE_TAB, widget id, 0.

/* */

TGNumberEntryField(const TGWindow * p, Int_t id, Double_t val, GContext_t norm, FontStruct_t font, UInt_t option, ULong_t back) : TGTextEntry(p, new TGTextBuffer(), id, norm, font, option, back), fNeedsVerification(kFALSE), fNumStyle(kNESReal), fNumAttr(kNEAAnyNumber), fNumLimits(kNELNoLimits)

     Constructs a number entry field

TGNumberEntryField(const TGWindow * parent, Int_t id, Double_t val, EStyle style, EAttribute attr, ELimit limits, Double_t min, Double_t max) : TGTextEntry(parent, "", id), fNeedsVerification(kFALSE), fNumStyle(style), fNumAttr(attr), fNumLimits(limits), fNumMin(min), fNumMax(max)

     Constructs a number entry field

void SetNumber(Double_t val)

     Set the numeric value (floating point representation)

void SetIntNumber(Long_t val)

     Set the numeric value (integer representation)

void SetTime(Int_t hour, Int_t min, Int_t sec)

     Set the numeric value (time format)

void SetDate(Int_t year, Int_t month, Int_t day)

     Set the numeric value (date format)

void SetHexNumber(ULong_t val)

     Set the numeric value (hex format)

void SetText(const char *text)

     Set the value (text format)

Double_t GetNumber() const

     Get the numeric value (floating point representation)

Long_t GetIntNumber() const

     Get the numeric value (integer representation)

void GetTime(Int_t & hour, Int_t & min, Int_t & sec) const

     Get the numeric value (time format)

void GetDate(Int_t & year, Int_t & month, Int_t & day) const

     Get the numeric value (date format)

ULong_t GetHexNumber() const

     Get the numeric value (hex format)

Int_t GetCharWidth(const char *text) const

     Get the text width in pixels

void IncreaseNumber(EStepSize step, Int_t stepsign, Bool_t logstep)

     Increase the number value

void SetFormat(EStyle style, EAttribute attr)

     Set the numerical format

void SetLimits(ELimit limits, Double_t min, Double_t max)

     Set the numerical limits.

void SetState(Bool_t state)

     Set the active state

Bool_t HandleKey(Event_t * event)

     Handle keys

Bool_t HandleFocusChange(Event_t * event)

     Handle focus change

void TextChanged(const char *text)

     Text has changed message

void ReturnPressed()

     Return was pressed

void Layout()

     Layout

### Inline Functions

                                  void ~TGNumberEntryField()
                                  void SetLogStep(Bool_t on = kTRUE)
                TGNumberFormat::EStyle GetNumStyle() const
            TGNumberFormat::EAttribute GetNumAttr() const
                TGNumberFormat::ELimit GetNumLimits() const
                              Double_t GetNumMin() const
                              Double_t GetNumMax() const
                                Bool_t IsLogStep() const
                               TClass* Class()
                               TClass* IsA() const
                                  void ShowMembers(TMemberInspector& insp, char* parent)
                                  void Streamer(TBuffer& b)
                                  void StreamerNVirtual(TBuffer& b)
                    TGNumberEntryField TGNumberEntryField(const TGNumberEntryField&)

Author: Daniel Sigg 03/09/2001
Last update: root/gui:$Name: $:$Id: TGNumberEntry.cxx,v 1.9 2004/10/11 16:25:10 rdm Exp $
Copyright (C) 1995-2001, Rene Brun and Fons Rademakers. *