[SOLVED] TScrollBox doesn't scroll TImage child lazarus / 31-LCL ---------------------------------------------------------------------- tofdesbois · 2017-04-03 14:17 Hello, I tested this in Lazarus 1.6.4 and in CodeTyphon 5.8. Version : Win32 on Windows 10. In a simple example, I put a TScrollBox, and in it a Tbutton and a TImage (with a Picture to see what appends). And 2 buttons outside the Scrollbox, to scroll it, and 2 labels to control : 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 TForm1.ButtonUpClick(Sender: TObject);begin  ScrollBox1.ScrollBy(0, 100);  ScrollBox1.Repaint; // to avoid shadow images  Label1.Caption := IntToStr(Image1.Top);  Label2.Caption := IntToStr(ButtonTest.Top);end; The test button scrolls correctly, but the image doesn't move. Does someone know why ? Is it a bug ? Thanks. ---------------------------------------------------------------------- ASerge · 2017-04-04 08:54 Quote from: tofdesbois on April 03, 2017, 04:17:34 pm...Win32 on Windows 10. In a simple example, I put a TScrollBox, and in it a Tbutton and a TImage ... The test button scrolls correctly, but the image doesn't move. Does someone know why ? Is it a bug ? No. TButton is a windowed control, but TImage is not. Therefore, Windows.ScrollWindowEx does not scrolls it (there is no window to receive messages about changing the position). Put the TImage on a windowed item such as a TPanel ---------------------------------------------------------------------- tofdesbois · 2017-04-04 10:40 Ok, thank you. It's for a migration from Delphi 6. It's working in Delphi. Is TImage windowed in Delphi ? ---------------------------------------------------------------------- ASerge · 2017-04-04 14:16 Quote from: tofdesbois on April 04, 2017, 12:40:36 pmIt's working in Delphi. Is TImage windowed in Delphi ? Also not a windowed control. But Delphi makes some additional adjustments of the controls after scrolling, Lazarus no. Here in Lazarus: 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 TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer);begin  ScrollBy_WS(DeltaX, DeltaY);end;...procedure TWinControl.ScrollBy_WS(DeltaX, DeltaY: Integer);begin  if HandleAllocated then    TWSWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY)  else    raise Exception.Create('TWinControl.ScrollBy_WS: Handle not allocated');end;...class procedure TWin32WSWinControl.ScrollBy(const AWinControl: TWinControl;  DeltaX, DeltaY: integer);begin  if AWinControl.HandleAllocated then    ScrollWindowEx(AWinControl.Handle, DeltaX, DeltaY, nil, nil, 0, nil,      SW_INVALIDATE or SW_ERASE or SW_SCROLLCHILDREN);end;Here in Delphi: [DELETED BY ADMIN ] ---------------------------------------------------------------------- Ondrej Pokorny · 2017-04-04 14:56 It's a bug. Please report to mantis. I remember Juha changed ScrollBy implementation. ---------------------------------------------------------------------- Ondrej Pokorny · 2017-04-04 15:16 Report to mantis = create a bug report on mantis.freepascal.org. ---------------------------------------------------------------------- Martin_fr · 2017-04-04 19:20 Quote from: ASerge on April 04, 2017, 04:16:42 pm[DELETED BY ADMIN ] The above post was modified by forum admin. Please do not copy and publish code from Delphi. (Or other copyrighted sources) Please also do not copy the Delphi code (or anything based on it / modified) to our bugtracker. You should report the bug. But the fixing must be done by a person who has not looked at the Delphi sources.