Link to home
Start Free TrialLog in
Avatar of kgerb
kgerbFlag for United States of America

asked on

Flex Grid Scrollbars Value Won't Change

I am trying to determine the value of the scrollbars property so that I know how wide make the last column in my Flex Grid.  The problem is that it doesn't matter how wide or long the data is in the grid, the value of .scrollbars is always 3 (both Hor. and Ver.).  I have tested it where the grid is filled with a single row of data that extends about half way accross the control but the .scrollbars property still returns 3?  Anybody have any ideas why the grid isn't recognizing that Hor or Vert scrollbars are not needed?

Here's my code:

    Select Case .ScrollBars
        Case 0 'No Scrollbars
            If ColWidth < ((.Width * 20) - 100) Then
                .ColWidth(.Cols - 1) = (.Width * 20) - ColWidth - 100
            End If
        Case 1 'Only Horizontal
            'Do Nothing
        Case 2 'Only Vervical
            If ColWidth < ((.Width * 20) - 360) Then
                .ColWidth(.Cols - 1) = (.Width * 20) - ColWidth - 360
            End If
        Case 3 'Both Horizontal and Vertical
            If ColWidth < ((.Width * 20) - 360) Then
                .ColWidth(.Cols - 1) = (.Width * 20) - ColWidth - 360
            End If
    End Select

Thanks so much,
Kyle
Avatar of kgerb
kgerb
Flag of United States of America image

ASKER

One more note, even though the .scrollbars property is always 3, it does not display Hor and Very scrollbars unless the data truly does extend beyond the limits of the grid.  So, it's working properly, I just can't figure out why the .scrollbars property is set to 3 when neither Hor or Ver scrollbars show up.
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kgerb

ASKER

Thank you both for you responses!  Very informative!

Z03niE,
Thanks for the snippet.  I have a very similar procedure that measures the width of all columns

So, is summing the width of all the rows and comparing that value to the height of the grid control the only way to determine if the grid has a vertical scrollbar ?  Or I guess you could count the rows and say if the number of rows is greater than x there will be a vertical scrollbar.  Is "measuring" the height and width of the data the only way to determine if Hor and Ver scrollbars are needed?  Not that I am unwilling to take that approach.  I'm just wondering if there is a property for this.

Thanks so much!
Avatar of kgerb

ASKER

Sorry it's taken so long.  Thank you both very much.  I appreciate your help.