private void MatItem_KeyPress(object sender, CellKeyPressEventArgs args)
        {
            if (GridNavigator.ColumnKeyPress(args, colItem.Index, MatItemChoose,
                                             MatItemEvaluate, MatItemEditPrev, MatItemEditNext))
            {
                return;
            }

            string gdkKey = KeyShortcuts.KeyToString(args.EventKey);
            string quickGoods;

            if (!BusinessDomain.QuickItems.TryGetValue(gdkKey, out quickGoods))
            {
                return;
            }

            if (!MatItemEvaluate(grdMaterials.EditedCell.Row, quickGoods))
            {
                return;
            }

            MatQtyEvaluate(grdMaterials.EditedCell.Row, 1);

            if (recipe.DetailsMat.Count <= grdMaterials.EditedCell.Row + 1)
            {
                recipe.AddNewDetail();
            }

            MatEditGridField(grdMaterials.EditedCell.Row + 1, colItem.Index);

            args.MarkAsHandled();
        }
Ejemplo n.º 2
0
        private void ItemColumn_KeyPress(object sender, CellKeyPressEventArgs args)
        {
            if (gridNavigator.ColumnKeyPress(args, colItem.Index, ItemColumnChoose,
                                             ItemColumnEvaluate, ItemColumnEditPrev, ItemColumnEditNext))
            {
                return;
            }

            string gdkKey = KeyShortcuts.KeyToString(args.EventKey);
            string quickGoods;

            if (!BusinessDomain.QuickItems.TryGetValue(gdkKey, out quickGoods))
            {
                return;
            }

            ItemColumnEvaluate(grid.EditedCell.Row, quickGoods);

            QtyColumnEvaluate(grid.EditedCell.Row, 1);

            if (selectedDetails.Count <= grid.EditedCell.Row + 1)
            {
                selectedDetails.Add(new SaleDetail());
            }

            EditGridCell(grid.EditedCell.Row + 1, colItem.Index);

            args.MarkAsHandled();
        }
        private void ProdItem_KeyPress(object sender, CellKeyPressEventArgs args)
        {
            if (SecondGridNavigator.ColumnKeyPress(args, colSecondItem.Index, ProdItemChoose,
                                                   ProdItemEvaluate, ProdItemEditPrev, ProdItemEditNext))
            {
                return;
            }

            string gdkKey = KeyShortcuts.KeyToString(args.EventKey);
            string quickGoods;

            if (!BusinessDomain.QuickItems.TryGetValue(gdkKey, out quickGoods))
            {
                return;
            }

            ProdItemEvaluate(grdProducts.EditedCell.Row, quickGoods);

            ProdQtyEvaluate(grdProducts.EditedCell.Row, 1);

            if (recipe.DetailsProd.Count <= grdProducts.EditedCell.Row + 1)
            {
                recipe.AddNewAdditionalDetail();
            }

            ProdEditGridField(grdProducts.EditedCell.Row + 1, colSecondItem.Index);

            args.MarkAsHandled();
        }
Ejemplo n.º 4
0
 private void Grid_CellKeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     if (KeyShortcuts.IsScreenModifierControl(args.EventKey.State) &&
         args.EventKey.Key == KeyShortcuts.DeleteKey.Key)
     {
         DeleteGridRow(true);
     }
 }
 private void grdProducts_CellKeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     if (KeyShortcuts.IsScreenModifierControl(args.EventKey.State) &&
         args.EventKey.Key == KeyShortcuts.DeleteKey.Key &&
         !editMode)
     {
         ProdDeleteRow(true);
     }
 }
Ejemplo n.º 6
0
 private void ContinueEditingIfValid(CellKeyPressEventArgs args, CellValueEvaluator evaluator,
                                     CellValueChooser chooser, string filter, CellValueContiueEdit contiueEdit)
 {
     if (evaluator(grid.EditedCell.Row, args.Entry.Text))
     {
         contiueEdit(grid.EditedCell.Row, args.GdkKey);
     }
     else if (chooser != null)
     {
         chooser(filter);
     }
 }
        private void ColumnDocumentNumber_KeyPressEvent(object sender, CellKeyPressEventArgs args)
        {
            if (args.Entry == null)
            {
                return;
            }

            long value;

            switch (args.GdkKey)
            {
            case Key.Return:
            case Key.KP_Enter:
            case Key.Tab:
                if (args.Entry.CursorPosition != args.Entry.Text.Length && args.GdkKey == Key.Right)
                {
                    return;
                }
                if (long.TryParse(args.Entry.Text.Trim(), out value))
                {
                    gridDocumentNumbers.EndCellEdit(value);
                }
                else
                {
                    gridDocumentNumbers.CancelCellEdit();
                }
                EditGridCell(new CellEventArgs(args.Cell.Column, args.Cell.Row + 1));
                break;

            case Key.ISO_Left_Tab:
                if (args.Entry.CursorPosition != 0 && args.GdkKey == Key.Left)
                {
                    return;
                }

                if (long.TryParse(args.Entry.Text.Trim(), out value))
                {
                    gridDocumentNumbers.EndCellEdit(value);
                }
                else
                {
                    gridDocumentNumbers.CancelCellEdit();
                }
                EditGridCell(new CellEventArgs(args.Cell.Column, args.Cell.Row - 1));
                break;

            case Key.Escape:
                gridDocumentNumbers.CancelCellEdit();
                break;
            }
        }
Ejemplo n.º 8
0
 private void ColumnShortcut_KeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     if (args.Editing && KeyShortcuts.CombinationValidForItem(args.EventKey))
     {
         currentKey      = new AccelKey(args.EventKey.Key, args.EventKey.State, AccelFlags.Visible);
         args.Entry.Text = KeyShortcuts.KeyToString(currentKey);
         args.MarkAsHandled();
     }
     switch (args.EventKey.Key)
     {
     case Key.BackSpace:
     case Key.Delete:
         currentKey      = AccelKey.Zero;
         args.Entry.Text = string.Empty;
         break;
     }
     gridNavigator.ColumnKeyPress(args, args.Cell.Column, ShortcutColumnEvaluate, ShortcutColumnEditPrev, ShortcutColumnEditNext);
 }
Ejemplo n.º 9
0
        private void GridBarcodes_CellKeyPressEvent(object sender, CellKeyPressEventArgs args)
        {
            if (KeyShortcuts.IsScreenModifierControl(args.EventKey.State) &&
                args.EventKey.Key == KeyShortcuts.DeleteKey.Key)
            {
                DeleteGridRow();
                // prevent the "Delete" key from acting upon the content of
                // the newly edited cell (i.e. from deleting the content)
                args.MarkAsHandled();
                return;
            }

            switch (args.EventKey.Key)
            {
            case Key.ISO_Left_Tab:
                if (args.Cell.Row == 0 && args.Cell.Column == 0)
                {
                    alignmentFocusStopper.GrabFocus();
                }
                break;
            }
        }
Ejemplo n.º 10
0
        private void CellKeyPress(CellKeyPressEventArgs args, PriceGroup groupColumn)
        {
            switch (args.GdkKey)
            {
            case Key.Tab:
            case Key.Return:
            case Key.KP_Enter:
                if (args.Editing && !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditNext(groupColumn);
                }
                break;

            case Key.ISO_Left_Tab:
                if (args.Editing && !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditPrev(groupColumn);
                }
                break;

            case Key.Right:
                if (args.Editing && args.Entry.CursorPosition == args.Entry.Text.Length &&
                    !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditNext(groupColumn);
                }
                break;

            case Key.Left:
                if (args.Editing &&
                    (args.Entry.CursorPosition == args.Entry.Text.Length || args.Entry.CursorPosition == 0) &&
                    !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditPrev(groupColumn);
                }
                break;

            case Key.Up:
            case Key.KP_Up:
                if (args.Editing && !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditOver(groupColumn);
                }
                break;

            case Key.Down:
            case Key.KP_Down:
                if (args.Editing && !CellEvaluate(args.Entry.Text, groupColumn))
                {
                    CellEdit(grid.FocusedCell.Row, groupColumn);
                }
                else
                {
                    ColumnEditBelow(groupColumn);
                }
                break;
            }
        }
Ejemplo n.º 11
0
        public bool ColumnKeyPress(CellKeyPressEventArgs args, int colIndex, CellValueChooser chooser,
                                   CellValueEvaluator evaluator, CellValueContiueEdit editPrev, CellValueContiueEdit editNext)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            string filter = args.Editing ? args.Entry.Text : string.Empty;

            if (KeyShortcuts.Equal(args.EventKey, KeyShortcuts.ChooseKey))
            {
                args.MarkAsHandled();
                return(ChooseCellValue(evaluator, chooser, filter));
            }

            switch (args.GdkKey)
            {
            case Key.Tab:
            case Key.Return:
            case Key.KP_Enter:
                if (args.Editing)
                {
                    ContinueEditingIfValid(args, evaluator, chooser, filter, editNext);
                }
                break;

            case Key.Right:
                if (args.Editing)
                {
                    // If the cursor is at the end of the text
                    if (args.Entry.CursorPosition == args.Entry.Text.Length)
                    {
                        ContinueEditingIfValid(args, evaluator, chooser, filter, editNext);
                    }
                }
                break;

            case Key.Left:
            case Key.ISO_Left_Tab:
                if (args.Editing)
                {
                    // If the cursor is at the end of the text
                    if (args.Entry.CursorPosition == args.Entry.Text.Length ||
                        args.Entry.CursorPosition == 0 ||
                        args.GdkKey == Key.ISO_Left_Tab)
                    {
                        ContinueEditingIfValid(args, evaluator, chooser, filter, editPrev);
                    }
                }
                break;

            case Key.Up:
            case Key.KP_Up:
                if (args.Editing)
                {
                    evaluator(grid.EditedCell.Row, args.Entry.Text);
                    cellUpEditor(colIndex);
                }
                break;

            case Key.Down:
            case Key.KP_Down:
                if (args.Editing)
                {
                    evaluator(grid.EditedCell.Row, args.Entry.Text);
                    cellDownEditor(colIndex);
                }
                break;

            case Key.BackSpace:
                if (args.Editing)
                {
                    if (args.Entry.Text.Length == 0)
                    {
                        evaluator(grid.EditedCell.Row, args.Entry.Text);
                        editPrev(grid.EditedCell.Row, args.GdkKey);
                    }
                }
                break;

            default:
                return(false);
            }

            return(true);
        }
Ejemplo n.º 12
0
 private void SalePriceColumn_KeyPress(object sender, CellKeyPressEventArgs args)
 {
     gridNavigator.ColumnKeyPress(args, colSalePrice.Index,
                                  SalePriceColumnEvaluate, SalePriceColumnEditPrev, SalePriceColumnEditNext);
 }
Ejemplo n.º 13
0
 private void QtyColumn_KeyPress(object sender, CellKeyPressEventArgs args)
 {
     gridNavigator.ColumnKeyPress(args, colQtty.Index,
                                  QtyColumnEvaluate, QtyColumnEditPrev, QtyColumnEditNext);
 }
Ejemplo n.º 14
0
 private void ColumnItem_KeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     gridNavigator.ColumnKeyPress(args, args.Cell.Column, ItemColumnChoose,
                                  ItemColumnEvaluate, ItemsColumnEditPrev, ItemColumnEditNext);
 }
Ejemplo n.º 15
0
        private void Column_KeyPressEvent(object sender, CellKeyPressEventArgs args)
        {
            switch (args.GdkKey)
            {
            case Key.Tab:
            case Key.Return:
            case Key.KP_Enter:
                if (args.Editing)
                {
                    if (EvaluateBarcode(args.Cell.Row, args.Entry.Text))
                    {
                        if (barcodes.Count <= gridBarcodes.EditedCell.Row + 1)
                        {
                            barcodes.Add(string.Empty);
                        }

                        EditGridCell(gridBarcodes.EditedCell.Row + 1, 0);
                    }
                    else
                    {
                        gridBarcodes.CancelCellEdit();
                        if (args.GdkKey != Key.Tab)
                        {
                            btnSave.GrabFocus();
                        }
                    }
                }
                break;

            case Key.Right:
                if (args.Editing)
                {
                    // If the cursor is at the end of the text
                    if (args.Entry.CursorPosition == args.Entry.Text.Length)
                    {
                        EvaluateBarcode(args.Cell.Row, args.Entry.Text);
                        if (barcodes.Count <= gridBarcodes.EditedCell.Row + 1)
                        {
                            barcodes.Add(string.Empty);
                        }

                        EditGridCell(gridBarcodes.EditedCell.Row + 1, 0);
                    }
                }
                break;

            case Key.Left:
            case Key.ISO_Left_Tab:
                if (args.Editing)
                {
                    // If the cursor is at the end of the text
                    if (args.Entry.CursorPosition == 0 ||
                        args.GdkKey == Key.ISO_Left_Tab)
                    {
                        EvaluateBarcode(args.Cell.Row, args.Entry.Text);
                        EditGridCell(gridBarcodes.EditedCell.Row - 1, 0);
                    }
                }
                break;

            case Key.Up:
            case Key.KP_Up:
                if (args.Editing)
                {
                    if (gridBarcodes.EditedCell.Row > 0)
                    {
                        EvaluateBarcode(args.Cell.Row, args.Entry.Text);
                        EditGridCell(gridBarcodes.EditedCell.Row - 1, 0);
                    }
                }
                break;

            case Key.Down:
            case Key.KP_Down:
                if (args.Editing)
                {
                    if (gridBarcodes.EditedCell.Row < gridBarcodes.Model.Count - 1)
                    {
                        EvaluateBarcode(args.Cell.Row, args.Entry.Text);
                        EditGridCell(gridBarcodes.EditedCell.Row + 1, 0);
                    }
                }
                break;

            case Key.BackSpace:
                if (args.Editing && args.Entry.Text.Length == 0)
                {
                    DeleteGridRow();
                }
                break;
            }
        }
Ejemplo n.º 16
0
 private void secondGrid_CellKeyPressEvent(object sender, CellKeyPressEventArgs args)
 {
     OnCellKeyPress(sender, args, false, operation.DetailsProd);
 }
Ejemplo n.º 17
0
 public bool ColumnKeyPress(CellKeyPressEventArgs args, int colIndex,
                            CellValueEvaluator evaluator, CellValueContiueEdit editPrev, CellValueContiueEdit editNext)
 {
     return(ColumnKeyPress(args, colIndex, null, evaluator, editPrev, editNext));
 }
 private void MatQty_KeyPress(object sender, CellKeyPressEventArgs args)
 {
     GridNavigator.ColumnKeyPress(args, colQuantity.Index,
                                  MatQtyEvaluate, MatQtyEditPrev, MatQtyEditNext);
 }
 private void ProdQty_KeyPress(object sender, CellKeyPressEventArgs args)
 {
     SecondGridNavigator.ColumnKeyPress(args, colSecondQuantity.Index,
                                        ProdQtyEvaluate, ProdQtyEditPrev, ProdQtyEditNext);
 }