I have a statusbar with 3 panels. When I change the text of them in runtime, it is not changed in the first one (index 0).
I see, this is happening only if other VCL theme is chosen (f.e. Cyan Dusk).
Initial design texts are:
StatusBar.Panels[0].Text := '1';
StatusBar.Panels[1].Text := '2';
StatusBar.Panels[2].Text := '3';
And in the runtime I changed it:
StatusBar.Panels[0].Text := '11'; // this is not changed visually
StatusBar.Panels[1].Text := '22';
StatusBar.Panels[2].Text := '33';
I tried also all this code after, nothing worked:
Application.ProcessMessages;
StatusBar.Refresh;
StatusBar.Update;
Refresh;
I tried it also in the blank new application, the same issue.
When I try to debug it, in Code Inspector I see, the value has been changed also for index 0.
Also I tried this:
procedure TMainForm.StatusBarClick(Sender: TObject);
begin
ShowMessage(StatusBar.Panels[0].Text); // 11
ShowMessage(StatusBar.Panels[1].Text); // 22
ShowMessage(StatusBar.Panels[2].Text); // 33
end;
But still in the Statusbar panel index 0 is only 1
.
Note: this is happening only if different VCL theme is used.
Is this bug in VCL themes? How can I evoke to update changed text?
UPDATE:
When I set StatusBar.StyleElements := StatusBar.StyleElements - [seClient];
it is working also for the first panel. But why without this it is working only for panels with index > 0?
So, it is bug in VCL themes. This solved the issue, and also updated text in the StatusBar.Panels[0]
:
StatusBar.StyleElements := StatusBar.StyleElements - [seClient];
Application.ProcessMessages;
StatusBar.Panels[0].Text := '11'; // now the text is updated visually
StatusBar.Panels[1].Text := '22';
StatusBar.Panels[2].Text := '33';
Application.ProcessMessages;
StatusBar.StyleElements := StatusBar.StyleElements + [seClient];
Application.ProcessMessages;