C1.Win.C1Command Is Context menu Open

Posted by: jeff.davies on 1 June 2022, 8:47 pm EST

    • Post Options:
    • Link

    Posted 1 June 2022, 8:47 pm EST

    Hi guys.

    I’m building a Windows app in VB.net.

    On a form, I have a C1ContextMenu with a number of commands added, opening on the right click of a TrueDBGrid.

    To know which row of the grid was clicked, I am setting a variable on the Mouse_Move event of the grid, and then I use that var in the event code of the menu’s click to get the row’s values.

    It works most of the time, but if the user moves the mouse outside of the menu once the menu is opened, the Row variable is changed resulting in the wrong row being referenced.

    Is it possible to test for the menu already being open in the Mouse_Move event, or is there a better way to capture the grid’s row?

    Thanks.

  • Posted 2 June 2022, 12:37 am EST

    Hi,

    To update your variable with the Current Row before the opening of C1ContextMenu on C1TrueDBGrid, you can use the MouseDown event of the C1TrueDBGrid. Using this event will not update the value of the Current Row when the user opens the C1ContextMenu and then moves the mouse cursor over another row. Kindly refer to the attached sample showing the same.

    C1ContextMenu_C1TDBG.zip

    Best Regards,

    Kartik

  • Posted 2 June 2022, 12:45 am EST

    Perfect thank you Kartik.

    I had tried Mouse Click with no success.

    Problem solved.

    Much appreciated.

    Jeff

Need extra support?

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

Learn More

Forum Channels