RAD Studio VCL Reference
|
Occurs when the in-place editor requests an edit mask.
property OnGetEditMask: TGetEditEvent;
__property TGetEditEvent OnGetEditMask;
Write an OnGetEditMask event handler to provide the in-place editor with an edit mask that describes the valid input strings a user can type into a cell. Set the Value parameter to the string that describes the edit mask for the cell specified by the ACol and ARow parameters. If the cell does not have an edit mask, set the Value parameter to an empty string.
OnGetEditMask does not occur unless the Options property includes goEditing.
C++ Examples:
/* This example specifies an edit mask in a string grid to limit the cells that contain telephone numbers, as indicated by a label cell in the first row. Include goEditing in the TStringGrid Options property. Set the title of one of the columns to 'Phone Number'. Set the DefaultColWidth large enough to see a phone number. */ void __fastcall TForm1::FormCreate(TObject *Sender) { StringGrid1->Cells[2][0] = "Phone Number"; } void __fastcall TForm1::StringGrid1GetEditMask(TObject *Sender, int ACol, int ARow, UnicodeString &Value) { if (StringGrid1->Cells[ACol][0] == "Phone Number") Value = "!\(999\)000-0000;1"; }
Delphi Examples:
{ This example specifies an edit mask in a string grid to limit the cells that contain telephone numbers, as indicated by a label cell in the first row. Include goEditing in the TStringGrid Options property. Set the title of one of the columns to 'Phone Number'. Set the DefaultColWidth large enough to see a phone number. } procedure TForm1.FormCreate(Sender: TObject); begin StringGrid1.Cells[2, 0]:= 'Phone Number'; end; procedure TForm1.StringGrid1GetEditMask(Sender: TObject; ACol, ARow: Longint; var Value: string); begin if StringGrid1.Cells[ACol, 0] = 'Phone Number' then Value := '!\(999\)000-0000;1'; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|