Ejemplo n.º 1
0
        private void grdDataRecommendation_MouseDown(object sender, MouseEventArgs e)
        {
            Point point = new System.Drawing.Point(e.X, e.Y);

            Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point);

            if (uiElement == null || uiElement.Parent == null)
            {
                return;
            }

            // Capturar valor de una celda especifica al hace click derecho sobre la celda k se quiere su valor
            Infragistics.Win.UltraWinGrid.UltraGridCell cell = (Infragistics.Win.UltraWinGrid.UltraGridCell)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell));
            Infragistics.Win.UltraWinGrid.UltraGridRow  row  = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow));

            if (row != null)
            {
                grdDataRecommendation.Rows[row.Index].Selected = true;
                contextMenuRecommendation.Items["mnuRemoveRecommendation"].Enabled = true;
                _rowIndexRecommendation = row.Index;

                if (grdDataRecommendation.Selected.Rows[0].Cells[0].Value != null)
                {
                    _ComponentFieldValuesRecommendationId = grdDataRecommendation.Selected.Rows[0].Cells[0].Value.ToString();
                }
            }
            else
            {
                contextMenuRecommendation.Items["mnuRemoveRecommendation"].Enabled = false;
            }
        }
        private void grdData_MouseDown(object sender, MouseEventArgs e)
        {
            Point point = new System.Drawing.Point(e.X, e.Y);

            Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point);

            if (uiElement == null || uiElement.Parent == null)
            {
                return;
            }

            // Capturar valor de una celda especifica al hace click derecho sobre la celda k se quiere su valor
            Infragistics.Win.UltraWinGrid.UltraGridCell cell = (Infragistics.Win.UltraWinGrid.UltraGridCell)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell));
            Infragistics.Win.UltraWinGrid.UltraGridRow  row  = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow));

            if (row != null)
            {
                grdData.Rows[row.Index].Selected = true;
                contextMenuGrdData.Items["removerToolStripMenuItem"].Enabled = true;
                _rowIndex = row.Index;
            }
            else
            {
                contextMenuGrdData.Items["removerToolStripMenuItem"].Enabled = false;
            }
        }
Ejemplo n.º 3
0
        private void grdProtocolComponent_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                Point point = new System.Drawing.Point(e.X, e.Y);
                Infragistics.Win.UIElement uiElement = ((Infragistics.Win.UltraWinGrid.UltraGridBase)sender).DisplayLayout.UIElement.ElementFromPoint(point);

                if (uiElement == null || uiElement.Parent == null)
                {
                    return;
                }

                // Capturar valor de una celda especifica al hace click derecho sobre la celda k se quiere su valor
                Infragistics.Win.UltraWinGrid.UltraGridCell cell = (Infragistics.Win.UltraWinGrid.UltraGridCell)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell));
                Infragistics.Win.UltraWinGrid.UltraGridRow  row  = (Infragistics.Win.UltraWinGrid.UltraGridRow)uiElement.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridRow));

                if (row != null)
                {
                    _rowIndexPc = row.Index;


                    if (row.Cells["v_ProtocolComponentId"].Value != null)
                    {
                        _protocolComponentId = row.Cells["v_ProtocolComponentId"].Value.ToString();
                    }

                    grdProtocolComponent.Rows[_rowIndexPc].Selected = true;

                    cmProtocol.Items["Edit"].Enabled = true;

                    if (_mode == "Edit")
                    {
                        OperationResult objOperationResult  = new OperationResult();
                        var             isProtocolInService = _protocolBL.IsExistsProtocol(ref objOperationResult, _protocolId);

                        if (isProtocolInService)
                        {
                            cmProtocol.Items["delete"].Enabled = false;
                        }
                        else
                        {
                            cmProtocol.Items["delete"].Enabled = true;
                        }
                    }
                    else
                    {
                        cmProtocol.Items["delete"].Enabled = true;
                    }
                }
                else
                {
                    cmProtocol.Items["delete"].Enabled = false;
                    cmProtocol.Items["Edit"].Enabled   = false;
                }
            }
        }
Ejemplo n.º 4
0
        public static void UltraGrid_KeyPress(object sender, KeyPressEventArgs e)
        {
            Infragistics.Win.UltraWinGrid.UltraGrid grid = (sender as Infragistics.Win.UltraWinGrid.UltraGrid);

            Infragistics.Win.UltraWinGrid.UltraGridCell activeCell = grid == null ? null : grid.ActiveCell;

            // if there is an active cell, its not in edit mode and can enter edit mode
            if (null != activeCell && false == activeCell.IsInEditMode && activeCell.CanEnterEditMode)
            {
                // if the character is not a control character
                if (char.IsControl(e.KeyChar) == false)
                {
                    // try to put cell into edit mode
                    grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);

                    // if this cell is still active and it is in edit mode...
                    if (grid.ActiveCell == activeCell && activeCell.IsInEditMode)
                    {
                        // get its editor
                        Infragistics.Win.EmbeddableEditorBase editor = grid.ActiveCell.EditorResolved;

                        // if the editor supports selectable text
                        if (editor.SupportsSelectableText)
                        {
                            // select all the text so it can be replaced
                            editor.SelectionStart  = 0;
                            editor.SelectionLength = editor.TextLength;

                            if (editor is Infragistics.Win.EditorWithMask)
                            {
                                // just clear the selected text and let the grid
                                // forward the keypress to the editor
                                editor.SelectedText = string.Empty;
                            }
                            else
                            {
                                // then replace the selected text with the character
                                editor.SelectedText = new string(e.KeyChar, 1);

                                // mark the event as handled so the grid doesn't process it
                                e.Handled = true;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        // Make right click select row.
        // Also, make clicking off of an element clear selected row
        // --------------------------------------------------------
        private void _grid_Logins_MouseDown(object sender, MouseEventArgs e)
        {
            Infragistics.Win.UIElement elementMain;
            Infragistics.Win.UIElement elementUnderMouse;

            elementMain = this._grid_Logins.DisplayLayout.UIElement;

            elementUnderMouse = elementMain.ElementFromPoint(new Point(e.X, e.Y));
            if (elementUnderMouse != null)
            {
                Infragistics.Win.UltraWinGrid.UltraGridCell cell = elementUnderMouse.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell)) as Infragistics.Win.UltraWinGrid.UltraGridCell;
                if (cell != null)
                {
                    m_gridCellClicked = true;
                    Infragistics.Win.UltraWinGrid.SelectedRowsCollection sr = _grid_Logins.Selected.Rows;
                    if (sr.Count > 0)
                    {
                        foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in sr)
                        {
                            row.Selected = false;
                        }
                    }
                    cell.Row.Selected      = true;
                    _grid_Logins.ActiveRow = cell.Row;
                }
                else
                {
                    m_gridCellClicked = false;
                    Infragistics.Win.UltraWinGrid.HeaderUIElement       he = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.HeaderUIElement)) as Infragistics.Win.UltraWinGrid.HeaderUIElement;
                    Infragistics.Win.UltraWinGrid.ColScrollbarUIElement ce = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.ColScrollbarUIElement)) as Infragistics.Win.UltraWinGrid.ColScrollbarUIElement;
                    Infragistics.Win.UltraWinGrid.RowScrollbarUIElement re = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.RowScrollbarUIElement)) as Infragistics.Win.UltraWinGrid.RowScrollbarUIElement;
                    if (he == null && ce == null && re == null)
                    {
                        _grid_Logins.Selected.Rows.Clear();
                        _grid_Logins.ActiveRow = null;
                    }
                }
            }

            updateContextMenuAndSetMenuConfiguration();
        }