Done a bit more troubleshooting but no closer to a workable solution.
Adding to the constructor:
Position:= poScreenCenter;
writeln('constructor, top=',top,' left=',left);
and then adding
writeln('resize top=',self.top,' left=',self.left);
to the resize function results in:
constructor, top=0 left=0
resize top=0 left=0
resize top=390 left=1120
resize top=390 left=1120
resize top=390 left=1120
resize top=390 left=1120
resize top=358 left=1080
resize top=358 left=1080
resize top=358 left=1080
resize top=358 left=1080
resize top=342 left=1060
resize top=342 left=1060
resize top=310 left=1020
resize top=310 left=1020
resize top=310 left=1020
resize top=310 left=1020
resize top=294 left=1000
resize top=294 left=1000
resize top=262 left=960
resize top=262 left=960
resize top=246 left=940
resize top=246 left=940
clearly using
poScreenCenter does not assign any values to left or top, but you can see the form moving towards the top left of the screen (0,0) as it is resized. As soon as you resize (X,Y) values are assigned (so why not with
poScreenCenter?).
replacing
poScreenCenter with
in the constructor results in:
constructor, top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=400 left=400
resize top=368 left=360
resize top=368 left=360
resize top=352 left=340
resize top=352 left=340
resize top=352 left=340
resize top=352 left=340
resize top=352 left=340
resize top=320 left=300
resize top=320 left=300
resize top=304 left=280
resize top=304 left=280
resize top=288 left=260
resize top=288 left=260
same as before, but the form is initially positioned at (400,400) and resizing rapidly moving it towards (0,0).
Adding
self.top:= 400;
self.left:= 400;
to the resize function, produces the desired end result but in an undesired fashion.
As the form is resized by dragging the mouse it is visually moving towards (0,0). When the mouse is released the form snaps to the desired position at (400,400). If this is an improvement, it is a very small improvement. Would be disconcerting to an end user.
I'm a little further forward but would appreciate some suggestions:
- how to calculate top left on the message form (X,Y) as poScreenCenter doesn't result in any values?
- what is causing the problem in the first place - so when you resize the form (X,Y) remains unchanged?
The form moves top left
as soon as you start to drag the size with the mouse. Is this a bug in the GTK implementation?
Would welcome any ideas on things to try.
To add to my previous, running linux mint 20.1 with lazarus 2.0.10.