girlswants_me
asked on
Ttable question
I placed a Ttable component in FORM1, then double click on the Ttable component. There is a FORM1.Table1 that will pop-up, then i tried to create a new field.
The above procedure is done manually, how about if i will make that procedure above dynamic like having a source code to create a new field from the FORM1.table1.
How will i do that?
The above procedure is done manually, how about if i will make that procedure above dynamic like having a source code to create a new field from the FORM1.table1.
How will i do that?
ASKER
Hi Sjohnson,
Yes i can add field with my TTABLE even though without having a database table linked to it. Try this.
1. Double click on any Ttable component and a tool window will popup
2. Right click inside the tool window (Form1.Table1) and select "New Field..."
3. Now, a NEW FIELD dialog will come out. Place any values on the fields under NEW FIELD dialog.
4. You will now have a field inside the Form1.Table1 tool window.
Does FieldsDefs.add() method is the same as above?
Yes i can add field with my TTABLE even though without having a database table linked to it. Try this.
1. Double click on any Ttable component and a tool window will popup
2. Right click inside the tool window (Form1.Table1) and select "New Field..."
3. Now, a NEW FIELD dialog will come out. Place any values on the fields under NEW FIELD dialog.
4. You will now have a field inside the Form1.Table1 tool window.
Does FieldsDefs.add() method is the same as above?
ASKER
And if FieldsDefs.add() is the same as what i did on the procedures, how can i assign a code inside the event OnGetTex(Sender: TField; var Text: String; DisplayText: Boolean) ?
procedure TForm1.CurrencyGetText(Sen der: TField; var Text: String;
DisplayText: Boolean);
begin
Text:='The value is ' + Sender.asstring;
end;
procedure TForm1.CurrencyGetText(Sen
DisplayText: Boolean);
begin
Text:='The value is ' + Sender.asstring;
end;
I'm just on my way home now, so I'll look at this more closely when I get home.
When you add the field definitions manually (through the IDE), can you actually populate those fields with data? Do you set a TableName as well? I've just never done it like this before (I guess I can't see why it won't work).
Stuart.
When you add the field definitions manually (through the IDE), can you actually populate those fields with data? Do you set a TableName as well? I've just never done it like this before (I guess I can't see why it won't work).
Stuart.
Note:
AddFieldDef is only valid in the context of creating field definitions for a table to be created with a subsequent call to the CreateTable or CreateDataSet method. It cannot be used to add fields to an already-existing table.
AddFieldDef is only valid in the context of creating field definitions for a table to be created with a subsequent call to the CreateTable or CreateDataSet method. It cannot be used to add fields to an already-existing table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot.
If you want to add a new calculated or lookup field to the Ttable, you can do that with the FieldDefs property (look in the help for FieldsDefs.Add). It's quite easy to do.
Stu.