Board index » delphi » Persistent editmask ?

Persistent editmask ?

Is it possible to assign TStringField( ).editmask property
during a runtime TTable create, and have the mask be persistent?

If so, when (or how).

There is no field count until after (TTable).CreateTable.
I have tried assigning mask after....

 **************************************
 with TTable.create (self) do
 begin
 ... (add Fld Defs .... etc)
 CreateTable;
 open;
 TStringField(fields[0]).editmask := aMask;
 ...
 >> Seems like there needs to be a way to do it here....
 >> The mask works fine, but I don't know how to make it
 >>  stick (these tables are being built from flat file DB
 >>  on the fly)...
 >>
 >> Is only way to write to *.dfm?

 **************************

Thanks
JMcKay

 

Re:Persistent editmask ?


Quote
>Is it possible to assign TStringField( ).editmask property
>during a runtime TTable create, and have the mask be persistent?

You need to first create persistent tfieilds
table1 := ttable.create(self)
with TTable1 do begin
 ... (add Fld Defs .... etc)
 CreateTable;
 open;
 FieldDefs.Update
  Table1.Close;
  for i := 0 to FieldDefs.Count - 1 do
    FieldDefs.Items[i].CreateField(Table1);
//now set edit mask
 TStringField(fields[0]).editmask := aMask;

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads