What happen on TListBox.Items.Add? lazarus / 31-LCL ---------------------------------------------------------------------- staratel20 · 2016-04-22 20:10 Hi to all. Probably, newbie question, but... If I have next code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ts:=TStrings.create;ts.Add('dfdfd');it will raise exception. But if I add on form lb:TListBox, which have property FItems:TStrings then I can write: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lb.Items.Add('sdsd');if the end of the end this code will call procedure: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Insert(Index: Integer; const S: string); virtual; abstract; so question is - who take care about implementation of Insert? When I set breakpoint on lb.Items.Add('sdsd'); and press F7 I can't step in. ---------------------------------------------------------------------- balazsszekely · 2016-04-22 20:19 You should never create an instance of TStrings directly, instead use a child class such TStringList. TStrings is just an abstract class. ---------------------------------------------------------------------- staratel20 · 2016-04-22 22:02 Yes, know it. But question is - where is implementation of virtual method Insert in class TListBox(or something what implement insertion). ---------------------------------------------------------------------- wp · 2016-04-22 22:28 Quote from: staratel20 on April 23, 2016, 12:02:56 amwhere is implementation of virtual method Insert in class TListBox(or something what implement insertion). Insert is a method of TListbox.Items which is declared as TStrings and implemented as TExtendedStringList. TExtendedStringList does not have its own Insert method but uses the one inherited from TStringList: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Procedure TStringList.Insert(Index: Integer; const S: string);begin  If Sorted then    Error (SSortedListError,0)  else    If (Index<0) or (Index>FCount) then      Error (SListIndexError,Index)    else      InsertItem (Index,S);end; ---------------------------------------------------------------------- staratel20 · 2016-04-22 23:42 wp: thanks a lot! I really overlook, that FItems only declared as TStrings, but in constructor created as: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i FItems := TExtendedStringList.Create(GetCachedDataSize);Maybe someone also tell me how to make F7 step in when I'm on line lb.Items.Add('something'); ?