Try attached demo to see that it is working.
procedure TForm1.ReadFromIni;
...
PairSplitter1.Position := ini.ReadInteger('PairSplitter', 'Position', PairSplitter1.Width div 2);
Change your code to look likeWell, it is working for me also with your modification...Code: [Select]procedure TForm1.ReadFromIni;
...
PairSplitter1.Position := ini.ReadInteger('PairSplitter', 'Position', PairSplitter1.Width div 2);
and it won't work any more.
Well, it is working for me also with your modification...
Since widgetset-dependent code is involved in the TPairSplitter: What is your widgetset? I am on Windows.
That makes no sense really, did you call the UPDATE or repaint after setting from INiFile?
That makes no sense really, did you call the UPDATE or repaint after setting from INiFile?
What I said: UpdatePosition. The FPosition field (hence Position property) appears to not track manual changes, at least on gtk2.
MarkMLl
Are you seeing the Position property track manual movement of the splitter?After calling a "Label1.Caption := IntToStr(PairSplitter1.Position)" in the OnResize event of a TPairSplitterSize I see the label text varying according to the splitter position during dragging. Moreover, setting "PairSplitter1.Position := 100" in the OnClick event of a button is executed immediately, and the new position value is displayed in the label.
Are you seeing the Position property track manual movement of the splitter?After calling a "Label1.Caption := IntToStr(PairSplitter1.Position)" in the OnResize event of a TPairSplitterSize I see the label text varying according to the splitter position during dragging. Moreover, setting "PairSplitter1.Position := 100" in the OnClick event of a button is executed immediately, and the new position value is displayed in the label.
So, the answer is: Yes.
This is on Lubuntu 18.10 / gtk2.
function TCustomPairSplitter.GetPosition: integer;
begin
if HandleAllocated and (not (csLoading in ComponentState)) then
UpdatePosition;
Result := FPosition;
end;
procedure TCustomPairSplitter.SetPosition(const AValue: integer);
begin
if FPosition = AValue then
Exit;
...
If you look at the setter you will see that nothing happens if the parameter is the same as the current value of FPosition:This is standard behaviour of most property setters: when the new property value already is identical to the old value there's nothing else to be done.Code: [Select]procedure TCustomPairSplitter.SetPosition(const AValue: integer);
So a manual adjustment of position followed by a change of position under program control will do noting if the manual change didn't update FPosition
begin
if FPosition = AValue then
Exit;
...
Note that setting Sides[1].Width does not call UpdatePosition which might be considered a bug. At least the user should know...
If you use a "WITH" statement on a structural property, like a record or something that contains sub members and you alter the values of these members within the WITH block, the Setter of the property will not get called.
Comitted to trunk (r61909) and requested back-porting to fixes.