Jump to content

FindComponent in UniScrollBox


artem_niko

Recommended Posts

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...