diff --git a/lcl/include/trackbar.inc b/lcl/include/trackbar.inc index 17b697ce53..8328119c88 100644 --- a/lcl/include/trackbar.inc +++ b/lcl/include/trackbar.inc @@ -112,14 +112,22 @@ end; Change the orientation of the trackbar. ------------------------------------------------------------------------------} procedure TCustomTrackBar.SetOrientation(Value: TTrackBarOrientation); +var + OldWidth: LongInt; + OldHeight: LongInt; begin if FOrientation <> Value then begin FOrientation := Value; - if HandleAllocated then - begin + // switch width and height, but not when loading, because we assume that the + // lfm contains a consistent combination of Orientation and (width, height) + if not (csLoading in ComponentState) then begin + OldWidth:=Width; + OldHeight:=Height; + SetBounds(Left,Top,OldHeight,OldWidth); // TODO: Remove RecreateWnd - RecreateWnd(Self); + if HandleAllocated then + RecreateWnd(Self); end; end; end; diff --git a/lcl/interfaces/win32/win32callback.inc b/lcl/interfaces/win32/win32callback.inc index 310993b85e..f220dedfe4 100644 --- a/lcl/interfaces/win32/win32callback.inc +++ b/lcl/interfaces/win32/win32callback.inc @@ -1749,9 +1749,9 @@ begin Show := WParam <> 0; Status := LParam; End; - - if assigned(lWinControl) and ((WParam<>0) or not lWinControl.Visible) - and ((WParam=0) or lWinControl.Visible) + //DebugLn(GetStackTrace(false)); + if assigned(lWinControl) {and ((WParam<>0) or not lWinControl.Visible) + and ((WParam=0) or lWinControl.Visible)} and (Application<>nil) and (lWinControl=Application.MainForm) then begin if WParam=0 then