How to activate the cursor in the grid

Posted by: soraroid on 18 December 2024, 1:06 am EST

    • Post Options:
    • Link

    Posted 18 December 2024, 1:06 am EST

    Hello.

    I have a few questions.

    Please refer to the source for more details.

    1. If you click in the date field and press Enter there, the data in the summary will disappear.

    2. I would like to know how when I press enter on date, it will be in the same state as if I clicked on summary.

    Please reply with the corrected source.

    thank you.

    FlexGrid-Text-edit_241218.zip

  • Posted 18 December 2024, 6:25 am EST

    Hi,

    Use the following code (return true) to achieve the required behaviour:

     protected override bool OnKeyDown(KeyboardEventArgs e)
     {
         int row = Grid.Selection.Row;
         // Get the Active Column Index
         int activeCol = Grid.CursorRange.Column;
         // Get the Column Name of the Active Field
         string columnName = Grid.Columns[activeCol].ColumnName;
    
    
         if (e.Key == "Enter" || e.Code == "NumpadEnter")
         {
    
    
             switch (activeCol)
             {
                 case 0:
                     {
                         Grid.FocusAsync();
                         Grid.StartEditingAsync(row, 1, false);
                         return true;
                     }
                 default:
                     break;
             }
             return base.OnKeyDown(e);
         }
         return base.OnKeyDown(e);
     }

    Let us know if you still face the issue.

    Regards,

    Ankit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels