FlexGrid - Unexpected height of FixedRow

Posted by: lars.dankenbrink on 14 April 2020, 8:34 am EST

    • Post Options:
    • Link

    Posted 14 April 2020, 8:34 am EST - Updated 3 October 2022, 11:47 pm EST

    Hello Support-Team,

    I’ve got an unexpected behaviour with a fixed row in FlexGrid-Control. Using latest build 4.5.20201.416.

    Please see the attached sample-program:

    After starting program the fixed row is very high - about 113 pixels (Screenshot-1). When you untick the ExtendLastCol-Checkbox, autosizing works well and the height of fixed row is as expected (Screenshot-2).

    At the moment I didn’t excatcly understand the reason for this…? But I think it must have to do with ExtendLastCol-Method…

    If you do some code-change and put .AutoSizeRows before .ExtendLastCol, behaviour is vice versa regarding the checkbox state.

    Could you please assist and point me to the right direction?

    Thank you and kind regards! :slight_smile:

    Lars

    WindowsApp1.zip

  • Posted 15 April 2020, 3:42 am EST

    Hi Lars,

    the workaround would be to autosize only the rows 1 to n:

    
          If (.Rows.Count > 1) Then
            .AutoSizeRows(1, 0, .Rows.Count - 1, .Cols.Count - 1, 0, AutoSizeFlags.IgnoreHidden)
          End If
    
    

    But if this behaviour changed in .416, this sounds like a bug.

    Best regards

    Wolfgang

  • Posted 15 April 2020, 4:02 am EST

    Hello Wolfgang,

    thanks for your reply and your idea for a workaround!

    Meanwhile I’ve adopted an other approach… Before calling .AutoSizeRows-Method I put the following code:

                
    Dim WidthAllCols As Integer = 0
    For i As Integer = 0 To .Cols.Count - 1
        If .Cols(i).Visible Then WidthAllCols += .Cols(i).Width
    Next
    If WidthAllCols >= Me.FlxValues.Width Then .ExtendLastCol = False
    
    

    It simply disables .ExtendLastCol when width of all columns is greater than FlexGrid-Object. But if you have a sizeable form where FlexGrid can grow it’s not the best solution so far…

    I think the behaviour was already there in Version 20193.393, but I’m not sure.

    For me it also sounds like a bug. But let’s see what support or the developers mean.

    Kind regards

    Lars

  • Posted 15 April 2020, 4:43 am EST

    Hi Lars,

    instead of using “ExtendLastCol”, you could also use “StarWidth”:

    flexGrid.Cols(5).StarWidth = "*"
    

    Now the col will fill all available area.

    You can also set a min width for the col.

    If you set a StarWidth for several cols, the available space will bei split to all cols with a StarWidth.

    Best regards

    Wolfgang

  • Posted 15 April 2020, 6:12 am EST

    Hi,

    @Wolfgang, thank you for the help.

    @Lars, we can replicate the issue at our end and have escalated this to the devs. For the time being, you can use any of the suggested approaches suggested by the @Wolfgang. If you have any doubts regarding this then please feel free to ask.

    [Internal Tracking ID: 431204]

    Regards,

    Prabhat Sharma.

  • Posted 15 April 2020, 9:28 am EST

    @Wolfgang:

    I’m using FlexGrid for so many years now, but I didn’t know StarWidth. This is a really cool function and superb tip. Thanks very much. Thumbs up!

    @Prabhat:

    Glad to hear that it’s replicable. As suggested by you, I will try some of the workarounds and properties I’ve learned today. Thanks, too! :wink:

    Kind regards

    Lars

  • Posted 15 April 2020, 9:34 am EST

    Lars, don’t worry, StarWidth was introduced in the mid of 2018, so it is rather new. But yes, it is a really cool feature!

  • Posted 5 July 2020, 12:57 pm EST

    This issue has been fixed in the latest hotfix builds i.e. 4.5.2.20201.424 and you can use the builds in your application to resolve the problem that you are getting at your end.

    You can upgrade the builds via latest ComponentOneControlPanel utility by following below given steps:

    1: Run the utility.

    2: Go to the UPDATE tab under the PRODUCTS tab.

    3: Check the option: Include prerelease and hotfix versions.

    4: Expand WinForms and click the update button.

    Regards,

    Prabhat Sharma.

  • Posted 6 July 2020, 1:45 am EST

    Hello Prabhat,

    thank you for information and the little “how to”. Will try it out the next days.

    :+1::blush:

    Regards

    Lars

Need extra support?

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

Learn More

Forum Channels