Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1612
Disable increase/decrease numbers in embended maskedEdit
posted

I'm using embended masked edit in WinGrid.

What I dislike is numbers ++/-- functionality when using up/down arrow keys.

I've tried to disable this option as presented below, but this doesnt work to me.

Any idea what I'm doing wrong... ?

 

            // Construct & setup editor
            UltraMaskedEdit    mtEdit    = new UltraMaskedEdit();

            // Common settings
            mtEdit.Visible                    = false;
            mtEdit.InputMask                = inputMask;
            mtEdit.Nullable                    = false;
            mtEdit.PromptChar                = ' ';
            column.Nullable                    = Infragistics.Win.UltraWinGrid.Nullable.Nothing;

            // Remove up/down arrow key action
             for (int i = mtEdit.KeyActionMappings.Count -1; i>=0; i--) {                   
                    KeyActionMappingBase kam = mtEdit.KeyActionMappings[i];
                    MaskedEditAction action = (MaskedEditAction)kam.ActionCode;
                    Console.WriteLine(action);

                    switch (action) {
                        case MaskedEditAction.DownKeyAction:
                        case MaskedEditAction.UpKeyAction:
                            mtEdit.KeyActionMappings.Remove(i);
                            break;
                    }               
                }       

            // Finally Marge with grid
            ultGrid.DisplayLayout.Bands[0].Columns[sourceColumn].EditorControl    = mtEdit;

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    I tried this and it worked:

    UltraGridColumn column = this.ultraGrid.DisplayLayout.Bands[0].Columns["whatever"];
    EditorWithMask editorWithMask = new EditorWithMask();
    column.Editor = editorWithMask;
    for ( int i = editorWithMask.KeyActionMappings.Count - 1; i >= 0; i-- )
    {
        KeyActionMappingBase km = editorWithMask.KeyActionMappings[i];
        if ( km.KeyCode == Keys.Up || km.KeyCode == Keys.Down )
            editorWithMask.KeyActionMappings.Remove( km );
    }

Children