[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

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
0
kgerb
Asked:
kgerb
  • 3
  • 2
2 Solutions
 
kgerbChief EngineerAuthor Commented:
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.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
The ScrollBars property doesn't reflect the current state of the scrollbars in the flexgrid.  Instead, it dictates how the flexgrid should react if the data is larger than the flexgrid can display.

Idle_Mind
0
 
Z03niECommented:
Idle_Mind is right.
For example if you set the ScrollBars Properti value to 1 (Horizontal), it'll only display Horizontal scrollbar, eventhough your columns width exceed the viewing are, the vertical scrollbar won't be displayed.
And on the contrary, if you set the ScrollBars Properti value to 2 (Vertical), it'll only display Vertical scrollbar, eventhough your rows excedd the viewing area , the Horizontal scrollbar won't be displayed.

if you want to know the exceed columns width maybe you might try this code.

        dim exceed,i as integer
        For I = 0 To MSHFlexgrid1.Cols - 1
            exceed= exceed + MSHFlexgrid1.ColWidth(I)         'calculating the width of all colums
        Next I
        exceed= exceed- MSHFlexgrid1.Width                      'substracting the flex width with the total colums width, to find out the width of the exceed columns
        MsgBox exceed

Something like that I guess.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kgerbChief EngineerAuthor Commented:
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!
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
kgerbChief EngineerAuthor Commented:
Sorry it's taken so long.  Thank you both very much.  I appreciate your help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now