How can I force horizontal scrollbar to appear |
Post Reply |
Author | |
Mike Lewis
Groupie Joined: 29 April 2009 Status: Offline Points: 41 |
Post Options
Thanks(0)
Posted: 15 May 2009 at 8:06am |
I am using the Report control to show a grid, in which there are maybe ten to 12 columns. It won't be possible for me to arrange things so that all the data in all the columns is always visible. The user will want to widen some of the columns, and use a horizontal scroll bar to see any colums that are outside the viewing area.
What I'm looking for is a way of forcing the horizontal scroll bar to be visible. I have tried setting the control's AutoSize to false, which I understand is necessary for the scrollbar to appear. Unfortunately, that means that, if the user resizes the form and makes the grid wider, the columns don't resize. Instead, there is white space to the right of the right-most column, which is undesirable. But even if I accept the white space, I've found that setting AutoSize to false doesn't itself make the scrollbar appear. I'd appreciate any suggestions. What I'd ideally like to have is a permanent scrollbar, and for the columns to resize themselves automatically when the grid is made either wider or narrower. My platform is Visual FoxPro 9.0, under Windows XP and Vista. I'm using the ActiveX version of the control. I'm not looking for any FoxPro-specific help. If someone can give me a solution in general terms, I can apply it to my specific platform Thanks in advance. Mike |
|
Mike Lewis
Software Developer Edinburgh, Scotland |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
Well you said it yourself, you have to set AutoColumnSizing to false in order to have horizontal scrollbars...
But... You can have AutoColumnSizing set to True, if you would set MinimumWidth for columns. When RC resizes the columns will AutoResize as well, if columnwidths equals/less than width, RC forces the horizontal scrollbar to be visible as well.
About "white space" you could add last column using:
Dim xtremeColumn As XtremeReportControl.ReportColumn
Set xtremeColumn = wndReportControl.Columns.Add(.......) xtremeColumn.DrawHeaderDivider = False
At least it looks like it's last column This will only work when columns can't be moved, grouped etc. etc. Could be done but you have to add code in columnchanged event and always set last column DrawHeaderDivider flag = false
You could consider using variable rowheight, the contents will be completely visible all the time and in combination with MinimumHeight you can have AutoColumnSizing and don't have to care about last column.
Hope this helps you a little
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Mike Lewis
Groupie Joined: 29 April 2009 Status: Offline Points: 41 |
Post Options
Thanks(0)
|
Hi Aaron,
Many thanks for your reply. I've tried setting minimum column widths, and setting AutoSize to .F. Now, I'm seeing the full widths of the columns when the grid is at its maximum size. But when I make it smaller, I only occasionally see the scroll bar. In other words, it's intermittent. Clearly, I need to figure out how to create the problem in a reproducible way. If I can do that, I'll post some more details here. I haven't yet tried your suggestion for getting rid of the white space. I'll do that next, but it's a slightly lower priority. I'll report back when I've got some more information. Mike |
|
Mike Lewis
Software Developer Edinburgh, Scotland |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
I'm not sure if my previous reply works properly with V13.0 (maybe you have to wait for V13.1 release)
See post https://forum.codejock.com/forum_posts.asp?TID=13379 for specific details
Well if you need more help, just post in forum
|
|
Product: Xtreme SuitePro (ActiveX) version 15.0.2
Platform: Windows XP (32bit) - SP 2 Language: Visual Basic 6.0 Zero replies is not an option.... |
|
Mike Lewis
Groupie Joined: 29 April 2009 Status: Offline Points: 41 |
Post Options
Thanks(0)
|
Hi Aaron,
I haven't had time to try your suggestions, as I got sidetracked on another project. With luck, I'll get back to it next week. Mike |
|
Mike Lewis
Software Developer Edinburgh, Scotland |
|
Mike Lewis
Groupie Joined: 29 April 2009 Status: Offline Points: 41 |
Post Options
Thanks(0)
|
Just to wind up this topic .....
I've got it working now. For the benefit of others with the same problem, here's what I did: 1. When adding the columns to the grid, set the last parameter (to the Add() method) to "false". This tells the grid to respect the column widths when it is resized. (This was what I was missing earlier.) 2. Subsequently, set each column's Resizable to "true" (this is not essential for this solution; it allows the user to resize the columns manually). 3. Set the grid's AutoColumnSizing to "false". 4. In the grid's Resize event, added code to loop through the columns collection, changing the width of each column in proportion to the change in the width of the grid. I now have the behaviour I want (almost). In particular, the horizontal scrollbar appears when needed, and the columns fill the grid to the right on resizing, that is, there is no unwanted white space. It's still not perfect. Occassionally, the scrollbar disappears for no obvious reason after a resize. But it comes back again if you just resize the form by a pixel or two in either direction. I think I can live with that. Mike |
|
Mike Lewis
Software Developer Edinburgh, Scotland |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |