2
I need to open a form on Delphi, but instead of calling him straight by name UniForm1
, I need to call you for the value stored in a String.
procedure TMainForm.UniTreeView1Change(Sender: TObject; Node: TUniTreeNode);
var nome : string;
tela : TUniForm;
begin
nome := Node.Text;
tela := FindComponent(nome) as TUniForm;
//UniPanel1.Caption := nome;
tela.Parent := UniPanel1;
tela.Show;
tela.SetFocus;
end;
However, when I select an item on Treeview, the following error occurs and does not open the form:
Project Log_project.exe Raised Exception class $C0000005 with message 'access Violation at 0x006d0f13: read of Adress 0x000003ce'.
What are you trying to do? The Findcomponent function is in the form (Tmainform). The form you want to search for is almost certainly not in that list. Because you don’t have a Dictionary with the Forms and their string names?
– Tiago Rodrigues