Hi, I'd like to save column position, visible and with in DBGrid. In Delphi I use this:
for J:= 0 to Grid.Columns.Count - 1 do begin Section:= Form.Name; Ident:= Grid.Name + ' ' + Grid.Columns[J].FieldName; Grid.Columns[J].Width:= StrToInt(Ini.ReadString(Section, Ident + ' Width', IntToStr(Grid.Columns[J].Width))); Grid.Columns[J].Index:= StrToInt(Ini.ReadString(Section, Ident + ' Index', IntToStr(Grid.Columns[J].Index))); end; But this doesn't work in Lazarus because TDBgrid doesn't have FieldName property. I tried this in Lazarus: Grid := (Form.Components[I] as TDBGrid); for J:= 0 to Grid.Columns.Count - 1 do begin Section := Form.Name; Ident := Grid.Name + ' ' + Grid.Columns[J].DisplayName; Grid.Columns[J].Width := StrToInt(Ini.ReadString(Section, Ident + ' Width', IntToStr(Grid.Columns[J].Width))); Grid.Columns[J].Index := StrToInt(Ini.ReadString(Section, Ident + ' Index', IntToStr(Grid.Columns[J].Index))); end; It works fine until user move field to another position. How do you solve this? Thanks for help. Petr -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
