AddShape/RemoveShape redraw cell problem

When cell in grid (TadvStringGrid) - for example cells[5,3] has some text then command

grid.AddShape(5,3,csCircle,clBlue, clBlue, haCenter,vaCenter);
and/or
grid.RemoveShape(5,3);
does not repaint cell - is is normal behaviour or error ?
Regards
 
Radim

Are you using the latest version?
This was retested here with a default grid on the form and the code:


procedure TForm1.Button1Click(Sender: TObject);
begin
  advstringgrid1.AddShape(2,3, csCircle,clBlue, clBlue, haCenter,vaCenter);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advstringgrid1.Cells[2,3] := 'test';
end;

and this works as expected.

Dear Bruno,

 
I am using latest available version 6.2.3.0 (19/12/2011). But TAdvStringGrid still report version 6.0.3.0
And If i create new project and insert your commands it is working.
But when I add Button2 with this OnClick event
 
procedure TForm1.Button2Click(Sender: TObject);
begin
  advstringgrid1.RemoveShape(2,3);
end;
 
The cell is not repainted if it contain text
 
Radim

We have traced & solved this issue. Next update will address this.

Dear Bruno, I have seen another issue with Add/RemoveShape with hidden rows in Grid

Grid contains some texts:
__1_2_3_4_5_6
1_a
2
3_b
4___c___d
5
6___________e
After Hiding free rows and columns (first hide rows, then columns as recommended in PDF - works fine as expected):
__1_2_4_6
1_a
3_b
4___c_d
6_______e
Than I would like to AddShape/RemoveShape for [4,4] cell
Grid.AddShape(4,4, ...) will AddShape to [4,5]

Grid.AddShape(Grid.RealColIndex(Grid.Col),Grid.RealRowIndex(Grid.Row), ...)

All of these commands are affected: AddShape(), RemoveShape(), CellTypes[] - if some rows are hidden then row is incremented by 1 and refer to cell [col, row+1], e.g [4,5] - column is still OK.

For referencing RealCol and ReadRow I am using - and this is working texts in Cells[col,row] is OK if some rows are hidden.
Grid.Cells[Grid.RealColIndex(Grid.Col),Grid.RealRowIndex(Grid.Row)] := 'x'

And for last it will be good to implement HideColList with similar function compared to HideRowList

Radim

There is currently unfortunately no support to add shapes to hidden rows.

Please add these to visible cells only and use the visible (display) row index.

Dear Bruno,

 
What do you mean use only visible "row" index. - Yes ofcourse I only add shapes to visibled rows (in OnKeyPress event - when user want to add it) - but I have some other cells/row hidden in grid.
 
Regards
 
Radim

The display index

Dear Bruno, thanks ...

 
So for CellTypes, AddShape, RemoveShape, Cells - when Iacces grid data [col,row] I must use this code to solve problem:
 
real_col := RealColIndex(col);
real_row := RealRowIndex(row);
use [ real_col, DisplRowIndex( real_row )]
 
Now It is working correctly. So there is possible error in maintaing grid data - with 'row' if exists hidden rows/cols.  
 
Regards
 
Radim