title: Delphi : Setting OnGetText Event Handler for fields of a dynamic query
body: <p>I want to set my own procedure to OnGetText event of fields in a dynamic query</p>
  
  <p>My procedure is like this :</p>
  
  <pre><code>procedure TMainFrm.MyFieldGetText(Sender: TField; var Text: String;
    DisplayText: Boolean);
  begin
  
    ...
  
  end;
  </code></pre>
  
  <ul>
  <li>"...Captions" are String array constants</li>
  </ul>
  
  <p>I set the event handler in OnAfterOpen event of ADOQuery :</p>
  
  <pre><code>procedure TImportFrm.ADOQueryAfterOpen(DataSet: TDataSet);
  var
   I : Integer;
  begin
   for I := 0 to ADOQuery.FieldCount - 1 do
    ADOQuery.Fields[I].OnGetText := MainFrm.MyFieldGetText;
  end;
  </code></pre>
  
  <p>But after opening ADOQuery , there is no Text to display , it looks like the Text value is empty !</p>
  
  <p><strong>It seems it doesn't matter what my procedure do , because when I set an empty procedure ( with no code ) , no text displayed too</strong></p>
  
  <p>what goes wrong ?</p>
  
  <p>thanks ...</p>