Solved

Flex Grid Scrollbars Value Won't Change

Posted on 2004-08-26
6
628 Views
Last Modified: 2013-12-25
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
Comment
Question by:kgerb
  • 3
  • 2
6 Comments
 
LVL 12

Author Comment

by:kgerb
ID: 11909378
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
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 300 total points
ID: 11909922
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
 
LVL 5

Assisted Solution

by:Z03niE
Z03niE earned 200 total points
ID: 11910265
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 12

Author Comment

by:kgerb
ID: 11911929
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
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 11916648
0
 
LVL 12

Author Comment

by:kgerb
ID: 11921655
Sorry it's taken so long.  Thank you both very much.  I appreciate your help.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now