Wrong sizing of TToolBar buttons when Parent is reassigned
Original Reporter info from Mantis: dezlov
-
Reporter name: Denis Kozlov
Original Reporter info from Mantis: dezlov
- Reporter name: Denis Kozlov
Description:
Changing TToolBar.Parent causes the controls inside TToolBar to be resized incorrectly exactly every 3rd time the Parent is assigned.
ToolBar1.Parent := Form1; // 1st time - sizing OK
ToolBar1.Parent := nil;
ToolBar1.Parent := Form1; // 2nd time - sizing OK
ToolBar1.Parent := nil;
ToolBar1.Parent := Form1; // 3rd time - sizing WRONG!
ToolBar1.Parent := nil;
(keeps repeating...)
I have narrowed it down to incorrect preferred size being calculated, but then I got lost in the sizing maze:
TToolBar.WrapButtons -> (inlined) CalculatePosition -> TControl.GetPreferredSize
Additional information:
If the source of the problem is indeed in GetPreferredSize, then it may be affecting other controls too, not just TToolBar, and not only when Parent is reassigned.
Affects all versions of Lazarus: 1.4.4, 1.6, 1.7.