Hello I am trying to use an edMaskEditBtn within a TAdvStringGrid however I am having issues getting the the mask validation to work.
I have put a TAdvStringGrid on a blank form and project.
I have changed the default options to include [goEditing].
Next I have added the following event codes:
procedure TForm1.AdvStringGrid1GetEditMask(Sender: TObject; ACol, ARow: Integer;
var Value: string);
begin
if (ARow=1) and (Acol=1) then
value:='00-0000';
end;
procedure TForm1.AdvStringGrid1GetEditorType(Sender: TObject; ACol,
ARow: Integer; var AEditor: TEditorType);
begin
if (ARow=1) and (Acol=1) then
aeditor:=edMaskEditBtn;
end;
I find that if I edit cell 1,1 I get the mask as expected, however if I make an entry that does not comply with the mask for example just entering two numeric digits. The application throws the error "Cannot focus a disabled or invisible window" when I press enter or try to exit the cell. Once the error has popped up, the cell is just left with the incorrect data.
Am I doing something wrong with this component?
How can I verify the input using the OnValidateCell event?