FlavioMacedo Posted April 24, 2017 Share Posted April 24, 2017 Good morning everyone. I'm facing a problem with unitreeview which consists of the following: I mount a treeview with 6 levels with only 20 records. He assembles the tree perfectly, but when I randomly click on the tree it will simply freeze after a few clicks (usually around 12 clicks). What can I be doing wrong? The encedeamento is by a text field of up to 20 characters. Thank you all. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 25, 2017 Share Posted April 25, 2017 Hi, Which version and build are you using? Can you provide us part of your code here? Best regards, Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted April 25, 2017 Administrators Share Posted April 25, 2017 Please test again with latest trial edition. Quote Link to comment Share on other sites More sharing options...
FlavioMacedo Posted April 25, 2017 Author Share Posted April 25, 2017 Good morning friends. I am using the latest evaluation version downloaded by the site. Go onchange code. If there is a simpler way to use Treeview I am totally open to suggestions as this is the first time I use this type of component. *********************************************************************************************************************************************************** procedure TMainForm.UniTreeView_libraryChange(Sender: TObject; Node: TUniTreeNode); begin DMSql.MemData_Library.Close; DMSql.MemData_Library.Open; nusuario := DMSql.Qry_UsuariosG003_CODIGO.AsInteger; No1 := ''; No2 := ''; No3 := ''; No4 := ''; No5 := ''; No6 := ''; No7 := ''; DMSql.Qry_Arquivos.Close; if (Node.Level = 0) then begin No1 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1); DMSql.Qry_Tree.Locate('Descricao_G021', No1, []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN2').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\'; end; if (Node.Level = 1) then begin No1 := Node.Parent.Text; No2 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2); DMSql.Qry_Tree.Locate('Descricao_G021;Descricao_G022', VarArrayOf([No1, No2]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN3').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\'; end; if (Node.Level = 2) then begin No1 := Node.Parent.Parent.Text; No2 := Node.Parent.Text; No3 := Node.Text; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3); Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\'; DMSql.Qry_Tree.Locate('Descricao_G021;Descricao_G022;Descricao_G023', VarArrayOf([No1, No2, No3]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN3').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN4').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\'; end; if (Node.Level = 3) then begin No1 := Node.Parent.Parent.Parent.Text; No2 := Node.Parent.Parent.Text; No3 := Node.Parent.Text; No4 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4); DMSql.Qry_Tree.Locate('Descricao_G021;Descricao_G022;Descricao_G023;Descricao_G024', VarArrayOf([No1, No2, No3, No4]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN3').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN4').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN5').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\'; end; if (Node.Level = 4) then begin No1 := Node.Parent.Parent.Parent.Parent.Text; No2 := Node.Parent.Parent.Parent.Text; No3 := Node.Parent.Parent.Text; No4 := Node.Parent.Text; No5 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5); DMSql.Qry_Tree.Locate('Descricao_G021;Descricao_G022;Descricao_G023;Descricao_G024;Descricao_G025', VarArrayOf([No1, No2, No3, No4, No5]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN3').AsString := Node.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN4').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN5').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN6').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\'; end; if (Node.Level = 5) then begin No1 := Node.Parent.Parent.Parent.Parent.Parent.Text; No2 := Node.Parent.Parent.Parent.Parent.Text; No3 := Node.Parent.Parent.Parent.Text; No4 := Node.Parent.Parent.Text; No5 := Node.Parent.Text; No6 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6); DMSql.Qry_Tree.Locate('Descricao_G021;Descricao_G022;Descricao_G023;Descricao_G024;Descricao_G025;Descricao_G026', VarArrayOf([No1, No2, No3, No4, No5, No6]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN3').AsString := Node.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN4').AsString := Node.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN5').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN6').AsString := Node.Text; DMSql.Qry_Arquivos.ParamByName('DN7').value := null; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6 + '\'; end; if (Node.Level = 6) then begin No1 := Node.Parent.Parent.Parent.Parent.Parent.Parent.Text; No2 := Node.Parent.Parent.Parent.Parent.Parent.Text; No3 := Node.Parent.Parent.Parent.Parent.Text; No4 := Node.Parent.Parent.Parent.Text; No5 := Node.Parent.Parent.Text; No6 := Node.Parent.Text; No7 := Node.Text; Caminho_Dir := caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6 + '\' + No7 + '\'; SetCurrentDir(caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6 + '\' + No7); DMSql.Qry_Tree.Locate ('Descricao_G021;Descricao_G022;Descricao_G023;Descricao_G024;Descricao_G025;Descricao_G026;Descricao_G027', VarArrayOf([No1, No2, No3, No4, No5, No6, No7]), []); if (DMSql.Qry_Tree.Eof) then begin ShowMessage('Problema de posicionamento na estrutura de diretorios'); exit; end; DMSql.Qry_Arquivos.ParamByName('DN1').AsString := Node.Parent.Parent.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN2').AsString := Node.Parent.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN3').AsString := Node.Parent.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN4').AsString := Node.Parent.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN5').AsString := Node.Parent.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN6').AsString := Node.Parent.Text; DMSql.Qry_Arquivos.ParamByName('DN7').AsString := Node.Text; UniServerModule.FilesFolder := servidor + caminho_database + Regist + '\' + No1 + '\' + No2 + '\' + No3 + '\' + No4 + '\' + No5 + '\' + No6 + '\' + No7 + '\'; end; if (No1 = '') then ShowMessage('Erro ao encadear treeviewer'); **************************************************************** Fields of treeview file ****************************************************************** G026_CODIGO: TIntegerField G027_CODIGO: TIntegerField G025_CODIGO: TIntegerField G024_CODIGO: TIntegerField G023_CODIGO: TIntegerField G022_CODIGO: TIntegerField G021_CODIGO: TIntegerField DESCRICAO_G021: TStringField DESCRICAO_G022: TStringField DESCRICAO_G023: TStringField DESCRICAO_G024: TStringField DESCRICAO_G025: TStringField DESCRICAO_G026: TStringField DESCRICAO_G027: TStringField ******************************************************************** Treeview query ******************************************************************** G027_CODIGO - G026_CODIGO - G025_CODIGO - G024_CODIGO - G023_CODIGO - G022_CODIGO - G021_CODIGO DESCRICAO_G021 - DESCRICAO_G022 - DESCRICAO_G023 - DESCRICAO_G024 - DESCRICAO_G025 - DESCRICAO_G026 DESCRICAO_G027 0 0 0 0 0 0 0 Hi Library 0 0 0 0 0 177 0 Hi Library Compras 0 0 0 0 180 177 0 Hi Library Compras Nacionais 0 0 0 0 181 177 0 Hi Library Compras Internacionais 0 0 0 0 0 178 0 Hi Library Vendas 0 0 0 0 182 178 0 Hi Library Vendas Orçamentos 0 0 0 0 183 178 0 Hi Library Vendas Pedidos 0 0 0 0 0 179 0 Hi Library Faturamento 0 0 0 0 184 179 0 Hi Library Faturamento Entradas 0 0 0 0 185 179 0 Hi Library Faturamento Saidas 0 0 0 0 0 180 0 Hi Library Financeiro 0 0 0 0 186 180 0 Hi Library Financeiro Recebimentos 0 0 0 0 187 180 0 Hi Library Financeiro Pagamentos 0 0 0 0 0 181 0 Hi Library Produção 0 0 0 0 188 181 0 Hi Library Produção Engenharia 0 0 0 0 189 181 0 Hi Library Produção Planejamento 0 0 0 0 190 181 0 Hi Library Produção Chão de fábrica 0 0 0 0 191 181 0 Hi Library Produção Qualidade 0 0 0 0 0 0 99 Lost+Found Thanks Quote Link to comment Share on other sites More sharing options...
FlavioMacedo Posted April 26, 2017 Author Share Posted April 26, 2017 Someone has been able to replicate the error so I can get an idea of what is happening. I had to stop all testing because of this problem. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 26, 2017 Share Posted April 26, 2017 Hi, I'm sorry, can you make a small testcase for your issue and share the download link please?! Best regards, 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.