<< Click to Display Table of Contents >> Navigation: Programming > Mail Merge (replace fields with data) and data forms > Forms & Edit Fields (data forms) > Hints |
This code can be used to move to a certain field. If the cursor is within a field with that name the next field will be located and selected.
procedure TWPEdTest.MoveToField(fieldname : String);
begin
fieldname := SelectField2.Text;
// If this is the current move on ...
if DataEdit.CurrentEditField=fieldname then
DataEdit.MoveToNextField(false);
// Try from here
if DataEdit.MoveToField(fieldname,false) then
DataEdit.SelectFieldAtCP(false, true)
// or from start
else if DataEdit.MoveToField(fieldname,true) then
DataEdit.SelectFieldAtCP(false, true);
DataEdit.SetFocus;
end;