Example #1
0
 public Keyboard(DataEntryField field)
 {
     MoreKey = new DMIIconButton("NA_23.bmp", "NA_23.bmp", "More", false, () =>
     {
         CurrentKeyPage++;
         if (CurrentKeyPage * 11 >= Keys.Count)
         {
             CurrentKeyPage = 0;
         }
         field.DataEntryWindow.PrepareLayout();
     }, 102, 50, field.DMI);
     MoreKey.Enabled = true;
 }
Example #2
0
        public DedicateKeyboard(List <string> keyLabels, DataEntryField field) : base(field)
        {
            int i = 0;

            foreach (string label in keyLabels)
            {
                if (label == null)
                {
                    Keys.Add(null);
                    i++;
                    continue;
                }
                DMIButton but = new DMITextButton(label, label, false, () => field.HandleKeyPress(label), 102, 50, field.DMI);
                but.Enabled = true;
                Keys.Add(but);
                i++;
            }
        }
Example #3
0
        public NumericKeyboard(DataEntryField field, bool enhanced = false) : base(field)
        {
            foreach (int i in Enumerable.Range(1, 10 - 1))
            {
                string digitname = i.ToString();
                Keys.Add(new DMITextButton(digitname, digitname, false, () => field.HandleKeyPress(digitname), 102, 50, field.DMI, 16));
            }
            Keys.Add(new DMIIconButton("NA_21.bmp", "NA_21.bmp", "Delete", false, () => field.HandleKeyPress("DEL"), 102, 50, field.DMI));
            Keys.Add(new DMITextButton("0", "0", false, () => field.HandleKeyPress("0"), 102, 50, field.DMI, 16));
            foreach (var key in Keys)
            {
                key.Enabled = true;
            }
            var dotkey = new DMITextButton(".", ".", false, () => field.HandleKeyPress("."), 102, 50, field.DMI, 16);

            dotkey.Enabled = enhanced;
            Keys.Add(dotkey);
        }
Example #4
0
        public AlphanumericKeyboard(DataEntryField field) : base(field)
        {
            Keys.Add(new DMITextButton("1", "1", false, () => field.HandleKeyPress("1"), 102, 50, field.DMI, 16));
            Keys.Add(new AlphanumericButton("2", "abc", field));
            Keys.Add(new AlphanumericButton("3", "def", field));
            Keys.Add(new AlphanumericButton("4", "ghi", field));
            Keys.Add(new AlphanumericButton("5", "jkl", field));
            Keys.Add(new AlphanumericButton("6", "mno", field));
            Keys.Add(new AlphanumericButton("7", "pqrs", field));
            Keys.Add(new AlphanumericButton("8", "tuv", field));
            Keys.Add(new AlphanumericButton("9", "wxyz", field));
            Keys.Add(new DMIIconButton("NA_21.bmp", "NA_21.bmp", "Delete", false, () => field.HandleKeyPress("DEL"), 102, 50, field.DMI));
            Keys.Add(new DMITextButton("0", "0", false, () => field.HandleKeyPress("0"), 102, 50, field.DMI, 16));
            foreach (var key in Keys)
            {
                key.Enabled = true;
            }
            var dotkey = new DMITextButton(".", ".", false, () => field.HandleKeyPress("."), 102, 50, field.DMI);

            Keys.Add(dotkey);
        }
Example #5
0
        public void PrepareLayout()
        {
            List <DMIArea> areas = new List <DMIArea>
            {
                CloseButton
            };

            foreach (int i in Enumerable.Range(0, Fields.Count))
            {
                if (i != ActiveField)
                {
                    Fields[i].SetSelected(false);
                }
            }
            Fields[ActiveField].SetSelected(true);
            if (!FullScreen)
            {
                Fields[0].DataArea.Position = new Point(0, 65);
                areas.Add(Fields[0].DataArea);
            }
            else
            {
                if (Fields.Count > 4)
                {
                    SetTitle(Title + " (" + (CurrentPage + 1) + "/" + NumPages + ")");
                    PrevButton.Position = new Point(416, 400);
                    NextButton.Position = new Point(498, 400);
                    areas.Add(NextButton);
                    areas.Add(PrevButton);
                }
                DataEntryCompleteLabel.Position = new Point(0, 330);
                YesButton.Position = new Point(0, 330 + DataEntryCompleteLabel.Height);
                areas.Add(DataEntryCompleteLabel);
                areas.Add(YesButton);
                for (int i = 4 * (ActiveField / 4); i < Fields.Count && i < (4 * (ActiveField / 4 + 1)); i++)
                {
                    Fields[i].LabelArea.Position = new Point(334, (i % 4) * 50);
                    Fields[i].DataArea.Position  = new Point(334 + Fields[i].LabelArea.Width, (i % 4) * 50);
                    areas.Add(Fields[i].LabelArea);
                    areas.Add(Fields[i].DataArea);
                }
            }
            for (int i = 0; i < 12; i++)
            {
                KeyboardButtons[i] = null;
            }
            DataEntryField field    = Fields[ActiveField];
            var            keyboard = field.Keyboard;

            for (int i = 0; i < 12; i++)
            {
                if (i == 11 && keyboard.Keys.Count > 12)
                {
                    KeyboardButtons[11] = keyboard.MoreKey;
                    break;
                }
                else if (i + keyboard.CurrentKeyPage * 11 < keyboard.Keys.Count)
                {
                    KeyboardButtons[i] = field.Keyboard.Keys[i + keyboard.CurrentKeyPage * 11];
                }
            }
            for (int i = 0; i < KeyboardButtons.Length; i++)
            {
                if (KeyboardButtons[i] == null)
                {
                    continue;
                }
                KeyboardButtons[i].Position = new Point((FullScreen ? 334 : 0) + i % 3 * 102, 200 + 50 * (i / 3));
                areas.Add(KeyboardButtons[i]);
            }
            SubAreas = areas;
        }
Example #6
0
 public AlphanumericButton(string num, string letters, DataEntryField field) : base(num + " " + letters, false, () => field.HandleKeyPress(num + letters), 102, 50, field.DMI, true)
 {
     Number  = num + " ";
     Letters = letters;
     SetText();
 }