Example #1
0
        public MobileControl CreateTextBox(int left, int top, int width, string controlName, ControlsStyle style, OnEventHandlingDelegate ProcTarget, bool isPasswordField, bool isTextField)
        {
            MobileControl NewControl = new MobileTextBox(MainForm, left, top, width, controlName, style, ProcTarget, isPasswordField, isTextField);

            ControlsArray.Add(NewControl);
            return(NewControl);
        }
Example #2
0
        private void createIntControls()
        {
            MobileTextBox textBox = (MobileTextBox)MainProcess.CreateTextBox(10, 150, 220, string.Empty, ControlsStyle.LabelLarge, false);

            textBox.Focus();
            controls.Add(textBox);
        }
Example #3
0
        /// <summary>Обьединение контролов "частичных значений" в единое значение</summary>
        /// <returns>Новое значение свойства</returns>
        private string concatValue()
        {
            StringBuilder valueBuilder = new StringBuilder();

            foreach (MobileControl control in controls)
            {
                MobileTextBox tb = control as MobileTextBox;
                if (tb != null)
                {
                    valueBuilder.Append(tb.Text);
                    continue;
                }

                MobileLabel l = control as MobileLabel;
                if (l != null)
                {
                    valueBuilder.Append(l.Text);
                    continue;
                }

                MobileTable t = control as MobileTable;
                if (t != null)
                {
                    valueBuilder.Append(selectedId);
                }
            }

            return(valueBuilder.ToString());
        }
Example #4
0
        private void createDateTimeControls()
        {
            MobileTextBox day   = (MobileTextBox)MainProcess.CreateTextBox(50, 150, 25, string.Empty, ControlsStyle.LabelLarge, false);
            MobileControl dot1  = MainProcess.CreateLabel(".", 80, 150, 5, MobileFontSize.Large, FontStyle.Bold);
            MobileControl month = MainProcess.CreateTextBox(90, 150, 25, string.Empty, ControlsStyle.LabelLarge, false);
            MobileControl dot2  = MainProcess.CreateLabel(".", 120, 150, 5, MobileFontSize.Large, FontStyle.Bold);
            MobileControl year  = MainProcess.CreateTextBox(130, 150, 50, string.Empty, ControlsStyle.LabelLarge, false);

            day.Focus();

            //сохранить нужно как: MM-dd-yyyy, а отображать: dd-MM-yyyy
            controls.Add(month);
            controls.Add(dot1);
            controls.Add(day);
            controls.Add(dot2);
            controls.Add(year);

            TextBox dayBox   = (TextBox)day.GetControl();
            TextBox monthBox = (TextBox)month.GetControl();
            TextBox yearBox  = (TextBox)year.GetControl();

            //dayBox.MaxLength = 2;
            dayBox.TextChanged += ValueEditor_TextChanged;
            //monthBox.MaxLength = 2;
            monthBox.TextChanged += ValueEditor_TextChanged2;
            //yearBox.MaxLength = 2;
            yearBox.TextChanged += ValueEditor_TextChanged3;
        }
Example #5
0
        /// <summary></summary>
        private void hideTextBox()
        {
            if (registerTextBox != null)
            {
                registerLabel.Show();

                if (string.IsNullOrEmpty(registerTextBox.Text))
                {
                    clearRegister();
                }
                else
                {
                    int registerValue;

                    try
                    {
                        registerValue = int.Parse(registerTextBox.Text);
                    }
                    catch (FormatException)
                    {
                        registerTextBox.Text = string.Empty;
                        registerValue        = 0;
                    }

                    if (registerValue >= MapInfo.Range.X && registerValue <= MapInfo.Range.Y)
                    {
                        registerLabel.Text = registerTextBox.Text;
                        registerLabel.SetControlsStyle(ControlsStyle.LabelNormal);
                    }
                    else
                    {
                        ShowMessage(string.Format("Допустимый диапазон значений:\r\n{0}-{1}",
                                                  MapInfo.Range.X,
                                                  MapInfo.Range.Y));
                    }
                }

                MainProcess.RemoveControl((Control)registerTextBox.GetControl());
                registerTextBox = null;
            }
        }
Example #6
0
        void ValueEditor_TextChanged2(object sender, EventArgs e)
        {
            TextBox textBox = sender as TextBox;

            if (textBox != null && textBox.Text.Length >= 2 && controls.Count == 5)
            {
                int months = Convert.ToInt32(textBox.Text);

                if (months < 13)
                {
                    textBox.Text = string.Format("{0:00}", months);
                    MobileTextBox newControl = (MobileTextBox)controls[4];
                    newControl.Focus();
                }
                else
                {
                    textBox.Text = textBox.Text.Substring(0, months >= 100 ? 2 : 1);
                    textBox.Select(1, 1);
                }
            }
        }
Example #7
0
        private void onNumeralBarcodeSymbol(char symb)
        {
            if (symb == 'X')
            {
                Barcode          = "";
                BarcodeTimeStart = DateTime.Now.Ticks;
                return;
            }

            if (BarcodeTimeStart != 0)
            {
                long MSecDiff = (DateTime.Now.Ticks - BarcodeTimeStart) / 10000;
                if (MSecDiff < 5000)
                {
                    if (symb == ']')
                    {
                        // Barcode data transfer complated
                        BarcodeTimeStart = 0;
                        if (MobileTextBox.IsNumber(Barcode))
                        {
                            MainForm.Client.OnBarcode(Barcode);
                        }
                    }
                    else
                    {
                        Barcode += symb.ToString();
                        if (Barcode.Length == 13)
                        {
                            onNumeralBarcodeSymbol(']');
                        }
                        BarcodeTimeStart = DateTime.Now.Ticks;
                    }
                }
                else
                {
                    BarcodeTimeStart = 0;
                }
            }
        }
Example #8
0
        /// <summary>Ввод регистра</summary>
        private void selectRegister()
        {
            if (registerTextBox == null)
            {
                registerTextBox =
                    (MobileTextBox)
                    MainProcess.CreateTextBox(120, 135, 100, "registerTB", ControlsStyle.LabelNormal,
                                              onRegisterTextChanged, false);
                registerTextBox.Text = registerLabel.Text != NOT_CHOOSEN ? registerLabel.Text : string.Empty;
                registerTextBox.Focus();
                registerLabel.Hide();
            }
            else
            {
                string oldValue = registerLabel.Text;
                hideTextBox();

                if (!oldValue.Equals(registerLabel.Text))
                {
                    clearPosition();
                }
            }
        }
Example #9
0
 public MobileTextBox CreateTextBox(int left, int top, int width, string controlName, ControlsStyle style,
     OnEventHandlingDelegate ProcTarget, bool isPasswordField, bool isTextField)
 {
     var NewControl = new MobileTextBox(MainForm, left, top, width, controlName, style, ProcTarget,
                                                  isPasswordField, isTextField);
     ControlsArray.Add(NewControl);
     return NewControl;
 }
Example #10
0
        /// <summary>���� ��������</summary>
        private void selectRegister()
        {
            if (registerTextBox == null)
                {
                registerTextBox =
                    (MobileTextBox)
                    MainProcess.CreateTextBox(120, 135, 100, "registerTB", ControlsStyle.LabelNormal,
                                              onRegisterTextChanged, false);
                registerTextBox.Text = registerLabel.Text != NOT_CHOOSEN ? registerLabel.Text : string.Empty;
                registerTextBox.Focus();
                registerLabel.Hide();
                }
            else
                {
                string oldValue = registerLabel.Text;
                hideTextBox();

                if (!oldValue.Equals(registerLabel.Text))
                    {
                    clearPosition();
                    }
                }
        }
Example #11
0
        /// <summary></summary>
        private void hideTextBox()
        {
            if (registerTextBox != null)
                {
                registerLabel.Show();

                if (string.IsNullOrEmpty(registerTextBox.Text))
                    {
                    clearRegister();
                    }
                else
                    {
                    int registerValue;

                    try
                        {
                        registerValue = int.Parse(registerTextBox.Text);
                        }
                    catch (FormatException)
                        {
                        registerTextBox.Text = string.Empty;
                        registerValue = 0;
                        }

                    if (registerValue >= MapInfo.Range.X && registerValue <= MapInfo.Range.Y)
                        {
                        registerLabel.Text = registerTextBox.Text;
                        registerLabel.SetControlsStyle(ControlsStyle.LabelNormal);
                        }
                    else
                        {
                        ShowMessage(string.Format("���������� �������� ��������:\r\n{0}-{1}",
                                                  MapInfo.Range.X,
                                                  MapInfo.Range.Y));
                        }
                    }

                MainProcess.RemoveControl((Control)registerTextBox.GetControl());
                registerTextBox = null;
                }
        }