Solved

Flex Grid Scrollbars Value Won't Change

Posted on 2004-08-26
6
631 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

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!

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

749 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