How do I write a procedure to modify the contents of a form's objects?
I currently have 2 procedures:
procedure TObjectForm.ObjectFormActivate(Sender: TObject);
begin
ObjIdxEdit.Text := ObjectTable.FieldByName('ObjIdx').AsString;
End
procedure TObjectForm.DBNavigator1Click(Sender: TObject;
Button: TDBNavButtonType);
begin
ObjIdxEdit.Text := ObjectTable.FieldByName('ObjIdx').AsString;
End;
Since they are both doing the same thing, I would like to call a procedure in each. Note iin my program, each of the original procedues doesn't have one duplicate instruction, but 20+!
What I tried to do was
A. Declare a procedure in the type section
Procedure ScrFldUpdate(Sender: TObject);
B. Create the procedure
Procedure TObjectForm.ScrFldUpdate(Sender: TObject);
Begin
ObjIdxEdit.Text := ObjectTable.FieldByName('ObjIdx').AsString;
End;
C Call this procedure from each of my previous procedures
TObjectForm.ScrFldUpdate(Sender);
I got the following error msg:
Error: Only class methods can be referred with class references
Thx, Terry