HoverMode

Posted by: philippe.berhin on 1 September 2023, 8:12 am EST

    • Post Options:
    • Link

    Posted 1 September 2023, 8:12 am EST

    Hi

    2023V2 comes with the interesting HoverMode

    But apparently, this one doesn’t work if you have your own OwnerDrawCall Method.

    Is there anything to care of to get it work or is simple not available in this mode ?

  • Posted 4 September 2023, 2:17 am EST

    Hi Philippe,

    If you have set the HoverMode of the C1FlexGrid and then apply custom styles using the OwnerDrawCell event, then these styles will override the Hover style used to draw the cells under the mouse. In this case, you will manually need to skip the event for the Hover style.

    Please see the attached sample project showing a simple implementation of the same. If you have any other implementation that shows any specific issue, please update the attached project to reproduce it, so we can investigate further and assist you better.

    FlexGrid.HoverMode.zip

    Best Regards,

    Kartik

  • Posted 4 September 2023, 4:02 am EST

    Perfect. This solved my issue

    Thanks for the quick response

  • Posted 4 September 2023, 5:08 am EST - Updated 4 September 2023, 5:13 am EST

    Correction. It seems to work but If you continuously change the cursor position over the grid, after a few seconds I got the following error. (see screenshot 1)

    Sometimes, error appears after 2 or 3 sec, sometimes I had to mouse the mouse for 15 sec or more before getting the error.

    Note: I also add a screenshot for a problem that I have regularly (also with previous version. I sometimes display the record number in the fixed column. When you scroll with the mouse, it happens sometimes that some numbers are not drawn correctly. (Cells are blank)

    Code used for the the OwnerDrawn is below. Just added the if (e.Style is { Name: “Hover” }) return to my current code.

    private void c1FlexInstrument_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)

    {

    ShowRowNo((C1FlexGrid)sender, e);

    }

    private void ShowRowNo(C1FlexGrid flex, OwnerDrawCellEventArgs e)
    {
        **if (e.Style is { Name: "Hover" }) return;**
    
        if (e.Row >= flex.Rows.Fixed && e.Col >= flex.Cols.Fixed)
            flex.Rows[e.Row][0] = (e.Row - 1).ToString(CultureInfo.InvariantCulture).PadLeft(5, '0');
    
        if (e.Row >= flex.Rows.Fixed && e.Col >= flex.Cols.Fixed)
            e.Style = flex.Row == e.Row || flex.Rows[e.Row].Selected
                ? flex.Col == e.Col && flex.Row == e.Row
                    ? flex.Styles["HighLightCell"]
                    : flex.Styles["HighLight"]
                : flex.Styles["MyDefault"];
        else e.Style = flex.Styles["Fixed"];
        e.Handled = false;
    }
    

    Note: If I set the e.Handle to true then cells are not drawn

  • Posted 5 September 2023, 3:49 am EST

    Hi,

    Thank you for providing all the details. For your information, this exception is observed due to a bug with the HoverMode feature in the 2023v2(611) version of C1FlexGrid. This issue has already been fixed internally and the fix will be available in the upcoming 2023v2 hotfix release. Unfortunately, there is no workaround for this issue currently.

    Furthermore, to show the record number in the fixed column, you should set the e.Text property in the OwnerDrawCell event instead of setting the cell value using flex.Rows[e.Row][0]. Please see the updated code snippet for reference.

    private void ShowRowNo(C1FlexGrid flex, OwnerDrawCellEventArgs e)
    {
        if (e.Row >= flex.Rows.Fixed && e.Col == 0)
            e.Text = (e.Row - 1).ToString(CultureInfo.InvariantCulture).PadLeft(5, '0');
    
        if (e.Style is { Name: "Hover" }) return;
    
        if (e.Row >= flex.Rows.Fixed && e.Col >= flex.Cols.Fixed)
            e.Style = flex.Row == e.Row || flex.Rows[e.Row].Selected
                ? flex.Col == e.Col && flex.Row == e.Row
                    ? flex.Styles["HighLightCell"]
                    : flex.Styles["HighLight"]
                : flex.Styles["MyDefault"];
        else e.Style = flex.Styles["Fixed"];
    }

    [Internal tracking ID: C1WIN-30986]

    Thanks, and Best Regards,

    Kartik

  • Posted 5 September 2023, 9:27 am EST

    Hi Kartik

    Thanks for the tip!

    and good to hear that bug will be fixed in the next hotfix release

  • Posted 4 October 2023, 8:15 am EST

    Hi Philippe,

    We are glad to let you know that the issue with the HoverMode has been fixed in the latest 2023v2(620) hotfix release. You can either install the latest release from ComponentOneControlPanel or directly install the latest packages from NuGet

    In the C1 Control Panel,

    1. Go to PRODUCTS > BUILD REPOSITORY tab
    2. Check the “Include prerelease and hotfix versions” checkbox
    3. Expand the WinForms Edition node.
    4. Click the “Update” button for the required .NET framework.
    5. Click the “Update to latest version” option.
    6. Click the “UPDATE” button.

    (https://www.nuget.org/packages/C1.Win.C1FlexGrid/4.8.20232.620)

    Best Regards,

    Kartik

  • Posted 4 October 2023, 10:46 am EST

    Hi Kartik

    Yes, I saw that hover issue has been solved in the hotfix.

    This is good. Now waiting for the designer bug fix (Labels in inputPanel have their break property set to Row while set originally to None. Issue occurs every time you open the designer…

    Philippe

  • Posted 4 October 2023, 11:19 pm EST

    Hi Philippe,

    We will surely notify you on the respective case once that issue gets resolved. If you have any other queries related to that issue, you can continue the thread in that support case.

    Regards,

    Kartik

Need extra support?

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

Learn More

Forum Channels