Hi,
I have the following issue:
When I do not have any grouping columns (i.e. a flat grid) the horizontal scrollbar does not appear on the grid. I do not have any problem with the vertical scrollbar.
I am using:
grid.TableControl.HScrollBehavior = (Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Automatic|Syncfusion.Windows.Forms.Grid.GridScrollbarMode.AutoScroll ) ;
I could get the scroll bar to display using the following line of code. But it is not enabled.
this.grid.TableControl.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Enabled ;
I tried the following but it does not help. this.grid.TableControl.UpdateScrollBars();
It is like if the grid thought that there were no other columns left to scroll to. As soon as I add a grouping to the grid, the horizontal scroll bar displays correctly.
Any ideas?
Thanks,
Erlly
EB
Erlly Bayuelo
April 5, 2005 05:27 PM UTC
After doing some further troubleshooting: I see that when I do not call grid.Table.TableDescriptor.Columns.Clear() and then add columns to the grid manually then the horizontal scrollbar shows. However we need to add columns manually so I am troubleshooting to see if its something in my function in which I add the columns using
int colIndex = this.grid.Table.TableDescriptor.Columns.Add(new GridColumnDescriptor(strColumnName,strColumnName));
Is there anything I should look for? Is there a function that resets the scroll bars after the TableDescriptor.Columns collection is cleared and columns are added manually?
AD
Administrator
Syncfusion Team
April 5, 2005 10:25 PM UTC
Hi Erlly,
I don''t really have any concrete idea what is going wrong here. Somehow the columns width must be calculated wrong at that time.
Some questions that I hope help to circle down where the problem could be:
What does the TableControl.GridBounds return – is it the rectangle you would expect.
What does GridTable.GetTotalWidthOfTable return?Is the value as expected.
Another value I would check: TableDescriptor.VisibleColumns.TotalWidth
Do these values return expected values?
What if you sum up all GridColumnDescriptor.Width entries? Do they look correct?
Is the grid inside a panel or another parent window?
Stefan
EB
Erlly Bayuelo
April 7, 2005 02:25 PM UTC
Hi,
Thanks for the ideas.
I queried the values you suggested and their values were in agreement with what was observed on the screen. The GridBounds rectangle is just the height and width of the grid which is unchanged, either way. However, when the horizontal scroll bar in missing the total widths are a lot below what I would expect to see.
Before I could continue troubleshooting using that route, I ran across the source of the problem:
If I declare:
this.grid.TopLevelGroupOptions.CaptionSummaryRow = "TotalRow"; and then do not add a grid summary row descriptor named "TotalRow" to grid.TableDescriptor.SummaryRows collection then the horizontal scroll bar does not display.
I do not know how this is internally related to the scroll bar.
Now I am just making sure that if I declare a CaptionSummaryRow, I add that definition to TableDescriptor.SummaryRows
I guess its good practice to actually add the SummaryRows to the collection and then attach their name to TopLevelGroupOptions.CaptionSummaryRow. Or does it not matter which comes first?
AD
Administrator
Syncfusion Team
April 7, 2005 09:16 PM UTC
Hi Erlly,
It should normally not matter which comes first as long as you do not access data from the engine that force it to initialize the display elements. In such case you will get a warning that the CaptionSummaryRow was not found. But it should be picked up later once it has been added to the SummaryRows.
But maybe that caused an exeption in your case.
So, yes, while not absolute necessary, it is good practice to first define the SummaryRow and add it to SummaryRows before referencing it by name in CaptionSummaryRow.
Stefan
>Hi,
>Thanks for the ideas.
>I queried the values you suggested and their values were in agreement with what was observed on the screen. The GridBounds rectangle is just the height and width of the grid which is unchanged, either way. However, when the horizontal scroll bar in missing the total widths are a lot below what I would expect to see.
>Before I could continue troubleshooting using that route, I ran across the source of the problem:
>
>If I declare:
>this.grid.TopLevelGroupOptions.CaptionSummaryRow = "TotalRow"; and then do not add a grid summary row descriptor named "TotalRow" to grid.TableDescriptor.SummaryRows collection then the horizontal scroll bar does not display.
>I do not know how this is internally related to the scroll bar.
>
>Now I am just making sure that if I declare a CaptionSummaryRow, I add that definition to TableDescriptor.SummaryRows
>I guess its good practice to actually add the SummaryRows to the collection and then attach their name to TopLevelGroupOptions.CaptionSummaryRow. Or does it not matter which comes first?