DBAdvGrid.IsEmpty

Hello, I have used the IsEmpty function in a TDBAdvGrid (I have assumed that it was used to know if a cell was empty, I have looked for it in the manuals but I have not found it):

 if Grid.IsEmpty[cont,Grid.Row] then
  ShowMessage...

It always gave me True even though the cell was not empty.

I have looked in the code and I have seen that the function is this:

function TAdvStringGrid.GetCellEmpty(ACol,ARow: Integer): boolean;
var
cg:TCellGraphic;

begin
Result := true;

if (ARow < 0) or (ACol < 0) then
exit;

if Assigned(GraphicObjects[ACol,ARow]) then
begin
if not (GraphicObjects[ACol,ARow] is TCellGraphic) then
exit;

cg := GraphicObjects[ACol,ARow] as TCellGraphic;

Result := (cg.CellType = ctNone) and (cg.CellComment = '');

end;
end;

Is the function used to know if the cell has comments? Or is it for internal use?

This is a function to check whether a cell contains a graphics object like checkbox, button, image, imagelist image, comment, ...
This does not related to the text content of a cell, only to a possible graphic object added to the cell.

1 Like