/***************************************************/ // __ ______ // /***************************************************/ using System.Drawing; using System.Windows.Forms; namespace IPadLibrary.FormsInterfaces { /// /// Keypad component, instantiate the Keypad Form. /// partial class NumericPad { /*******************************************************************************************/ /* Constant & Static Variables /*******************************************************************************************/ #region Constant & Static Variables private const char BACKSPACE_CHAR = '\u00dc'; ///< The simbol <-- private const int MAX_DISPLAY_NUMBERS = 9; ///< Maximun number of char to text #endregion /*******************************************************************************************/ /* Public Variables Definition /*******************************************************************************************/ #region Public Variables Definiton // ... #endregion /*******************************************************************************************/ /* Private Variables Definition /*******************************************************************************************/ #region Private Variables Definition private Button[] buttonGroupNumbers; ///< Used to manage all group of Keys buttons private Control owner; ///< The owner of Form Dialog private bool dot; ///< Monitor the dot key pression #endregion /*******************************************************************************************/ /* Public Methods Definition /*******************************************************************************************/ #region Public Methods Definition //------------------------------------ DIALOG SECTION -------------------------------------// /// /// Show this dialog, in modal mode. /// /// Any object that implement IWin32Window that is the fisrt level window owner of the modal dialog. /// One value of DialogResult. public DialogResult ShowDialog(Control owner) { this.owner = owner; return base.ShowDialog(owner); } //------------------------------------ GETS SECTION ---------------------------------------// /// /// Get/Set the text typed. /// public override string Text { get { if ( Display != null ) return Display.Text; else return ""; } set { if ( Display != null ) { Display.Text = value.Trim(); dot = value.IndexOf('.') == -1 ? false : true ; } } } /// /// Get/Set the password char for input data. /// public char PasswordChar { get { return Display.PasswordChar; } set { Display.PasswordChar = value; } } #endregion /*******************************************************************************************/ /* Private Methods Definition /*******************************************************************************************/ #region Private Methods Definition //------------------------------------- INIT SECTION --------------------------------------// /// /// Initialize all component of this Form. /// private void InizializeLocalData() { dot = false; BACKSPACE_Button.Text = BACKSPACE_CHAR.ToString(); buttonGroupNumbers = new Button[] { NUM0_Button, NUM1_Button, NUM2_Button, NUM3_Button, NUM4_Button, NUM5_Button, NUM6_Button, NUM7_Button, NUM8_Button, NUM9_Button }; setEventClick(buttonGroupNumbers); } /// /// Add Key_Button_Click Event to button. /// /// The Button the implement a click event. private void setEventClick(Button b) { b.Click += new System.EventHandler(KEY_Button_Click); } /// /// Add Key_Button_Click Event to buttons group. /// /// private void setEventClick(Button[] group) { foreach ( Button b in group ) b.Click += new System.EventHandler(KEY_Button_Click); } #endregion } // end class } // end namespace