Solved

Flex Grid Scrollbars Value Won't Change

Posted on 2004-08-26
6
627 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

746 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

16 Experts available now in Live!

Get 1:1 Help Now