I saw in the D2007 update 1 help errata mentioned that there is a way to
iterate over a record not mentioned in the help.

Does anyone have more information on this?

I am interested if this means there is a way to iterate over the fields in a
record, similar to iterating over the components on a form as in this
example below:

I have something not using the later iterator syntax but effectively doing
the same thing when I was writing a generic routine to print any form - it
has code like:

(comp here is the passed name of the form to print)


  for I := 0 to comp.ComponentCount - 1 do
  begin
    if Comp.components[i] is TEdit then
    begin
      ltype:='Edit';
      top:=(Comp.Components[i] as TEdit).top;
      left:=(Comp.Components[i] as TEdit).left;
      width:=(Comp.Components[i] as TEdit).width;
      text:=(Comp.Components[i] as TEdit).text;
      compfont:=(Comp.Components[i] as TEdit).font;
      lfontstyles:=(Comp.Components[i] as TEdit).font.style;
      lfontsize:=(Comp.Components[i] as TEdit).font.size;
      printablecomp:=true;
    end else
    if Comp.components[i] is TLabel then
    begin
      ltype:='Label';
      top:=(Comp.Components[i] as TLabel).top;
      left:=(Comp.Components[i] as TLabel).left;
      width:=(Comp.Components[i] as TLabel).width;
      text:=(Comp.Components[i] as TLabel).caption;
      compfont:=(Comp.Components[i] as TLabel).font;
      lfontstyles:=(Comp.Components[i] as TLabel).font.style;
      lfontsize:=(Comp.Components[i] as TLabel).font.size;
      printablecomp:=true;

   and so on....


John


_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi@delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to