Scrollbar in a cell

C++Builder XE2
TDBAdvGrid (version 2.3.6.19) connected to a TDataSource
One Field in the dataset ist a blob field and contains rich text.
The datasource is read only.

In the rich text column [2] in all cells should appear a scrollbar.
After opening the dataset I set the scrollbars with this code:

for(int iRow=1;iRow < DBAdvGrid1->RowCount;iRow++)
{
  if(DBAdvGrid1->HasScrollBar(2,iRow) == false)
    DBAdvGrid1->AddScrollBar(2,iRow,true);
}

1. Problem: the celle flicker constantly
2. Problem: After clicking on a scrollbar the record on the dataset changes.The text does'nt scroll.

What am I doing wrong?
Regards,
Josef

  1. Try to do this within grid.BeginUpdate / grid.EndUpdate calls
    2) Try setting grid.PageMode = false

Thanks Bruno.
It works.
But there is an optical problem with the scrollbar.
If I move the mouse into the cell then over the scrollbar appears a second scrollbar.
The second scrollbar is a little bit smaler so you can see both.
 


Is it possible to change the width of the second (hover) scrollbar?

I could not see this here so far.
What operating system is this?
Is this with or without runtime themes enabled in your app?
If there something specific wrt operating system settings, such as aero enabled/disabled  ... etc..

Hello Bruno,

What operating system is this?
> Windows 7
Is this with or without runtime themes enabled in your app?
> with runtime themes

If there something specific wrt operating system settings, such as aero enabled/disabled  ... etc..
> no

After your first feedback I set grid.PageMode = false. Then appeared in each row a scrollbar.
During my tests I changed some properties. And now only in one row apperars a scrollbar. I don't find the property or combination of properties are the cause.

My task:
I need a grid with 3 cells that shows datas like a listbox.
The datas comes form a dataset (
table). All is read only.
At a time only one row can be selected.

The first cells contains a date and an user name. It comes from two dataset fields. I solved it with grid.columns[].HTMLTemplate. It works perfekt.

The second cell contains rich text. It is connected to a blob field (
grid.columns[].FieldName). The display result is perfekt. Only the scrollbars makes problems.

In the third cell are 4 checkboxes. The data comes from four different bool fields. I solved it with

grid.cells[col][row] = "<CONTROL TYPE="CHECK" ......". The display result is perfekt. But with a click in the cell only the color of this cell change. The row selection (indicator) doesn't change. This irritates the user.

Is there an example like this available who I can find more information.

Thanks for any help!

It is unclear how you have the situation where the scrollbars only appear on one row. When grid.PageMode = false and you add the scrollbar AFTER activating the dataset, the scrollbars should be used on all cells where you added it.

About your question wrt the row selection, is this a grid where you had set goRowSelect = true in grid.Options?

That's my code:
DBAdvGrid1->PageMode = false;
Dataset->Open();
for(int iRow=1;iRow < DBAdvGrid1->RowCount;iRow++)
{
  if(DBAdvGrid1->HasScrollBar(2,iRow) == false)
    DBAdvGrid1->AddScrollBar(2,iRow,true);
}
At first it was ok, the scrollbars were visible.
Then I tried to adjust the DBAdvStringGrid that it appears similar to a listbox.
After some changes in the settings all scrollbars were no longer visible.
HasScrollBar(2,iRow) and HasAutoRangeScrollBar(2, iRow) both returns true for each row.
I have changed all settings which could be relatet with the scrollbars but it was not possilbe to make any scrollbar visible.
Perhaps important: The corresponding cell contains rich text. And the text is more than can be showed in the visible range.

Then I removed the DBAdvStringGrid completely and insertet a new from the tool palette.
Now it's ok, all scrollbars appears.

About the row selection:
goRowSelect is set to true.
I tried also with goRowSelect = false. Then I can select each cell separately like Borlands DBGrid.
Basically the row selection works. I'ts only when I click in the cell which contains HTML text.
Only in the clicked cell change the color and not in the complete row. And the indicator in the first fixed column doesn't move to the clicked row. But when I read DBAdvStringGrid1->Row it has the correct row index.

 

About the scrollbars, we cannot reproduce this here. If a problem persists, could you please create some sample source project with which we can reproduce this here to investigate.
With respect to the cells with HTML, do these cells have just an URL set via HTML tags? Other than URL click handling, I cannot reproduce or see a reason why the cell (or row when goRowSelect is enabled) would not be selected. This can also not be reproduced here.

I have a VCL form with sample code.
Is there a way to transfer the files?

You can send the zip file with your project to support@tmssoftware.com