[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Flex Grid Scrollbars Value Won't Change

Posted on 2004-08-26
6
Medium Priority
?
642 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 86

Accepted Solution

by:
Mike Tomlinson earned 1200 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 800 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 86

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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses

650 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