Good day!
I have several UniPanels dynamically created, on which UniScrollBoxes are also dynamically created, on which buttons are created.
I need to find the desired button by its name on, for example, a specific UniScrollBox and put focus on it, i.e. scroll the UniScrollBox vertical scrollbar and show the found button by highlighting it.
The code below throws an AccessViolation on the last line:
procedure TMainForm.UniButton1Click(Sender: TObject);
var
sb: TUniScrollBox;
btn: TUniFSButton;
begin
sb:=UniPanel5.FindChildControl('UniScrollBox2') as TUniScrollBox;
btn:=sb.FindComponent('UniFSButton43') as TUniFSButton;
btn.SetFocus;
end;
If you remove it and remove the code associated with sb , then there is no error.
Please help.