Good afternoon, I have created a treeview with the data that is in a table in the DB, and has a field that contains the name in the form. How to do to give a showmodal in the onclick event of the Treeview getting the name of the form that is in the table field?
follow the code
procedure CriaFormpeloNome(const FrmNome : string);
var
FrmClass : TFormClass;
Frm : TForm;
begin
try
FrmClass := TFormClass(FindClass(FrmNome));
Frm := FrmClass.Create(application);
except
//não achou a classe
showmessage('Nao Achou a classe');
end;
end;
procedure TFormFrontend.TreeView2DblClick(Sender: TObject);
var
Form2 : string;
begin
zmenu.SQL.Clear;
zmenu.SQL.Add('Select * from tab_menu');
zmenu.SQL.Add('WHERE id =:id');
zmenu.Params.ParamByName('id').value:= TreeView2.Selected.AbsoluteIndex;
zmenu.Open;
Form2:= zmenuarquivo.AsString;
Form2 := concat('T',Form2);
CriaFormpeloNome(Form2);
end;