[solved]Dynamic created TImages stop responding to @Image1MouseDown lazarus / 31-LCL ---------------------------------------------------------------------- dcom67 · 2021-09-15 18:35 I have 256 dynamically created Timage controls.  They all show up fine , But after the 232 one they stop responding to the @Image1MouseDown event. The same result if the event is changed to Im.OnCLick:=@Image1Click; Any Ideas ? IML : TObjectList; 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            IM:=TImage.Create(Self);             IM.Name:='IM'+IntToStr(a);           IM.Left:=(ScrollBox1.ClientWidth  div 2) -((w *24) div 2)-20;           if b = 0 then IM.Top:= 0  else               begin               I:=IML.Items[IML.Count-1] as TImage;                 IM.Top:=( I.Top +I.Height +22);               end;             IM.Width:=(w *24) *2;             IM.Height := (h*24)*2;             Panel2.Height:=Panel2.Height+ IM.Height+1;             IM.Stretch:= True;             IM.OnMouseDown:=@Image1MouseDown;             IM.Tag := a;             IML.Add(IM);             IM.Picture.LoadFromFile(TempDir+sa[0]+EPNG);             Im.Transparent:= True;             Im.Picture.Bitmap.TransparentMode:=tmfixed;             IM.picture.bitmap.Transparent:=True;             IM.Picture.Bitmap.TransparentColor:=$000000;             IM.Parent:= Panel2; ---------------------------------------------------------------------- Martin_fr · 2021-09-15 19:28 OS, Widgetset? P.s.: Edited your post to remove tons of empty lines ---------------------------------------------------------------------- dcom67 · 2021-09-15 19:52 Oh it is Win10  . Sorry didn't see all of those empty lines ---------------------------------------------------------------------- dcom67 · 2021-09-16 00:26 Yeah i was kind of afraid of that, but why do they show up and the event stops working ? The only other thing on the panel2 parent is a Tlabel for each image. I was kind of hoping to keep it looking like a list of images. And i have never used a TDrawGrid before. ---------------------------------------------------------------------- Remy Lebeau · 2021-09-16 00:28 Quote from: jamie on September 16, 2021, 01:50:24 amI would say you hit a limit with the number of TGraphicControl class a parent window can have. 256 sounds like a byte size limit. There should be no such limitation. Quote from: jamie on September 16, 2021, 01:50:24 amMaybe you should rethink your design a little where as you use a single parent control and you then calculate the mouse locations to which image they should go to.. A TDrawGrid is a good control for this.. I was thinking a TPaintBox. Quote from: dcom67 on September 16, 2021, 02:26:36 amYeah i was kind of afraid of that, but why do they show up and the event stops working ? Have you tried stepping through the LCL's source code to see where those mouse clicks are actually going? ---------------------------------------------------------------------- dcom67 · 2021-09-16 00:40 I set a BreakPoint in the mouse down event Yes they don't do anything for the mouse clicks ( for the ones that don't work)  all of the others activate the mouse down event as expected ---------------------------------------------------------------------- Remy Lebeau · 2021-09-16 00:46 Quote from: dcom67 on September 16, 2021, 02:40:25 amYes they don't do anything for the mouse clicks ( for the ones that don't work)  all of the others activate the mouse down event as expected My point was, at the moment that the click enters the underlying system (ie, the message queue reports a WM_MOUSEDOWN message), did you trace its handling from cradle to grave to see exactly where it is stopping in the LCL's code before it reaches your event handler?  Maybe the LCL is not able to correctly determine the control that the message belongs to, so it drops the message? Hard to say without a deep tracing of the LCL internals. ---------------------------------------------------------------------- dcom67 · 2021-09-16 00:50 Uh that is kind of beyond me. I only know how to set a breakpoint in my code ---------------------------------------------------------------------- dcom67 · 2021-09-16 14:58 I fixed it I added a second panel , and added the second panel as the parent above 200 images.