artem_niko Posted February 6, 2022 Share Posted February 6, 2022 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. Quote Link to comment Share on other sites More sharing options...
Tokay Posted February 7, 2022 Share Posted February 7, 2022 You can find UniFSButton43 on the UniScrollBox2 when Owner of the UniFSButton43 is UniScrollBox2. I think that Owner of the UniFSButton43 is your form. Components can be found only in the owner components list, not in any other. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.