Hello, you have to set this mask in the visual component to be used to display the field, for example the "PasswordChar" property of a TDBEdit / TEdit, by default the default value of the field is "# 0", you must change it to "*" or any other character you want to use as a mask.
Edited:
You will need to inherit the TString List class in its own class:
TMyGrid = class(TStringGrid)
protected
function CreateEditor: TInplaceEdit; override;
procedure DrawCell(ACol, ARow: Longint; ARect: TRect; AState: TGridDrawState); override;
end;
And then implement the redeclared methods:
function TMyGrid.CreateEditor: TInplaceEdit;
begin
Result := TInplaceEdit.Create(Self);
if (Passwd) then
TMaskEdit(Result).PasswordChar := '*';
end;
procedure TMyGrid.DrawCell(ACol, ARow: Integer; ARect: TRect;
AState: TGridDrawState);
begin
if (Passwd) then
Canvas.TextRect(ARect, ARect.Left+2, ARect.Top+2, StringOfChar('*', Length(Cells[ACol, ARow])))
else
Canvas.TextRect(ARect, ARect.Left+2, ARect.Top+2, Cells[ACol, ARow]);
end;
Then you can use your custom TStringGrid:
meuGrid := TMyGrid.Create(Self);
meuGrid.Parent := Self;
meuGrid.Left := 5;
meuGrid.Top := 5;
meuGrid.Width := 400;
meuGrid.Height := 400;
meuGrid.Options := meuGrid.Options + [goEditing];
This will work, you just need to define the logic of the variable "Passwd"
Hugs.