Error on AddObject TabControl.Tabs lazarus / 31-LCL ---------------------------------------------------------------------- morphocr · 2011-05-14 00:02 it works on the combobox.items but not in tabcontrol.tabs and both use tstrings Code: [Select]   tmyclass = class     tt  : integer;     a   : string;   end; . . . procedure TForm1.Button1Click(Sender: TObject); var    i      : integer;    temp   : tmyclass; begin      for i := 1 to 10 do      begin           temp := tmyclass.Create;           temp.a:='object#'+inttostr(i);           temp.tt:=i;           ComboBox1.Items.AddObject(temp.a,temp);           TabControl1.Tabs.AddObject(temp.a,temp);      end;      for i := 0 to ComboBox1.Items.Count-1 do      begin           showmessage(inttostr(tmyclass(ComboBox1.Items.Objects[i]).tt));           showmessage(inttostr(tmyclass(TabControl1.tabs.Objects[i]).tt));      end; end; ---------------------------------------------------------------------- DirkS · 2011-05-14 08:03 What error do you get? It would also be useful if you give details about Lazarus / Freepascal version, etc. Gr. Dirk. ---------------------------------------------------------------------- morphocr · 2011-05-14 21:46 Quote from: DirkS on May 14, 2011, 10:03:46 amWhat error do you get? It would also be useful if you give details about Lazarus / Freepascal version, etc. Gr. Dirk. thanks for your reply, when trying to get any objects fromCode: [Select]TabControl1.tabs.Objects[i] it come with -(maxInteger) value instead of the object pointer, and im using the follow Ide : - Lazarus Version #: 0.9.30 - Date: 2011-05-13 - FPC Version: 2.4.2 - SVN Revision: 29811M   for i386-linux-gtk 2 on Fedora 14 Box ---------------------------------------------------------------------- morphocr · 2011-05-20 20:34 anyone follow this ? ---------------------------------------------------------------------- eny · 2011-05-20 21:56 I'm assuming this is because ComboBox1.Items and TabControl1.Tabs are different beasts. ComboBox.Items is an actual TStringList (which has the Objects property implemented as expected). TabControl.Tabs is a TTabControlNoteBookStrings that has some fancy methods (not in the least an overriden PutObject(...)). Just create a separate TStringList where you store the info you need for your tabs.