Alex B. Posted November 29, 2022 Posted November 29, 2022 Bom dia, criei um procedimento para criar abas em tempo de execução, mas tem uma tela que as vezes dá erro... não consegui identificar o motivo... Na minha tela tenho um unidbgrid com os eventos: OnCellClick, OnDblClick, OnFieldImage e OnSetCellValue. Em OnDblClick eu chamo um procedimento que cria um UniTabShet em um UniPageControl. procedure TFormConsultaContasReceberVencidas2.UniDBGrid1DblClick( Sender: TObject); begin inherited; if uniDBGrid1.CurrCol = uniDBGrid1.Columns.Items[0].Index then begin if not qryTotalizado.IsEmpty then begin isFechaAba := True; criarAba(TFormCadastroCliente2, 'Cadastro de Clientes', 'CLIEA13ID = ' + QuotedStr(qryTotalizadoCLIEA13ID.AsString), EmptyStr); end; end; if uniDBGrid1.CurrCol = uniDBGrid1.Columns.Items[5].Index then begin DSMasterSys := dsTotalizado; criarAba(TFormCadastroClienteHistorico2, 'Cadastro Cliente Histórico', 'CLIEA13ID = ' + QuotedStr(qryTotalizadoCLIEA13ID.AsString), 'Cliente ' + qryTotalizadoCLIEA60RAZAOSOC.AsString) end; end; procedure criarAba(frame: TUniFrameClass; tituloTab, filtro, titulo: String); var tab: TUniTabSheet; FCurrentFrame: TUniFrame; qryTemplate: TFDQuery; tabName: String; begin try tab := getAba(frame, FormPrincipal.upcPrincipal); if tab <> nil then begin if frame = TFormCadastroCliente2 then begin if isFechaAba then begin isFechaAba := False; tab.Close; end else begin FormPrincipal.upcPrincipal.ActivePage := tab; Exit; end; end else begin FormPrincipal.upcPrincipal.ActivePage := tab; Exit; end; end; FormPrincipal.ShowMask('Aguarde...'); UniSession.Synchronize(); tab := TUniTabSheet.Create(FormPrincipal.upcPrincipal); if frame.ClassName.Contains('TFrmCadastro') then tabName := StringReplace(frame.ClassName, 'TFrmCadastro', 'tab', [rfReplaceAll, rfIgnoreCase]) else if frame.ClassName.Contains('TFrame') then tabName := StringReplace(frame.ClassName, 'TFrame', 'tab', [rfReplaceAll, rfIgnoreCase]) else if frame.ClassName.Contains('TFrm') then tabName := StringReplace(frame.ClassName, 'TFrm', 'tab', [rfReplaceAll, rfIgnoreCase]) else tabName := 'tab' + frame.ClassName; tab.Name := tabName; tab.caption := tituloTab; tab.PageControl := FormPrincipal.upcPrincipal; tab.OnClose := FormPrincipal.TabClose; tab.Closable := True; FCurrentFrame := TUniFrameClass(frame).Create(tab); if not Trim(titulo).IsEmpty then begin if Trim(FCurrentFrame.Hint).IsEmpty then FCurrentFrame.Hint := titulo else FCurrentFrame.Hint := titulo + ' - ' + FCurrentFrame.Hint; end; if FCurrentFrame.FindComponent('lblTitulo') <> nil then (FCurrentFrame.FindComponent('lblTitulo') as TUniLabel).caption := FCurrentFrame.Hint; qryTemplate := (FCurrentFrame.FindComponent('qryTemplate') as TFDQuery); if qryTemplate <> nil then begin if filtro.IsEmpty then qryTemplate.MacroByName('filtro').Value := qryTemplate.Fields.Fields[0].FieldName + ' IS NULL' else qryTemplate.MacroByName('filtro').Value := filtro; qryTemplate.Open(); end; FCurrentFrame.Align := alClient; FCurrentFrame.Parent := tab; FormPrincipal.pnlEsquerdo.Width := 210; FormPrincipal.upcPrincipal.ActivePage := tab; finally FormPrincipal.HideMask; end; end; https://ibb.co/KwBwMhb Obs: Nem sempre o erro acontece, acontece de vez em quando! Se alguém souber o motivo e puder me ajudar a ficarei grato. Quote
Sherzod Posted November 29, 2022 Posted November 29, 2022 Hello, First of all, please specify which edition and build of uniGUI are you using? Quote
Alex B. Posted November 29, 2022 Author Posted November 29, 2022 4 minutes ago, Sherzod said: Olá, Em primeiro lugar, especifique qual edição e compilação do uniGUI você está usando? Version: 1.90.0 build 1501 Quote
Sherzod Posted November 29, 2022 Posted November 29, 2022 2 minutes ago, Multistore said: Version: 1.90.0 build 1501 Edition? Quote
Alex B. Posted November 29, 2022 Author Posted November 29, 2022 9 minutes ago, Sherzod said: Você está usando a edição de avaliação? it's not the trial version, it's the standard version. Quote
Sherzod Posted November 29, 2022 Posted November 29, 2022 1 minute ago, Multistore said: it's not the trial version, it's the standard version. Then please adjust your forum email address first: Quote
Sherzod Posted November 29, 2022 Posted November 29, 2022 How often does the error occur? Can you update to the latest version and check? Quote
Alex B. Posted November 29, 2022 Author Posted November 29, 2022 26 minutes ago, Sherzod said: Com que frequência o erro ocorre? Você pode atualizar para a versão mais recente e verificar? occurs randomly, apparently when I remove the snippet below it works correctly: FormPrincipal.ShowMask('Wait...'); UniSession.Synchronize(); But I don't know if it really has anything to do with the problem. I am currently unable to update to the latest version... Quote
Alex B. Posted December 8, 2022 Author Posted December 8, 2022 On 29/11/2022 at 14:37, Sherzod said: Com que frequência o erro ocorre? Você pode atualizar para a versão mais recente e verificar? would you know any other possible solution to solve this problem? Quote
Sherzod Posted December 8, 2022 Posted December 8, 2022 On 11/30/2022 at 12:04 AM, Alex B. said: UniSession.Synchronize(); Are you using UniMainModule.EnableSynchronousOperations = True? Quote
Alex B. Posted December 21, 2022 Author Posted December 21, 2022 On 08/12/2022 at 09:26, Sherzod said: Você está usando UniMainModule.EnableSynchronousOperations = Verdadeiro? I'm using yes Quote
mikromundo Posted October 14, 2023 Posted October 14, 2023 @Sherzod@Hayri ASLAN@Farshad Mohajeri I see that there are several posts related to "showmask". I'm also having problems using synchronize and I see that it's better not to use it, but when should it really be used? Because there are some situations where some things only work with it. Ex: I click on the menu to call a form/frame but immediately click on another option. This sometimes works but sometimes generates an error with something called "tabconfig" that I've seen other related posts about this with no response. This seems like the wrong thing to do, but we develop systems for other users, and these users do unimaginable things and we need to try to create solutions to avoid this. Another situation is to keep a mask active until I actually order it to stop (hide), for example: - I click on unitreemainmenu - mask is displayed; - open a form/frame; - process some queries; - I hide the mask; This doesn't work, because when activating the mask of a UniDBGrid, for example, which is linked to one of the queries, the first mask (referring to the menu click) is already interrupted. I don't know if I managed to make myself understood, but basically, it's the same thing I've seen in other posts, but there was also no continuity. PS: It's not just me with this question and of course, I could be doing something wrong but I can't find the solution and that's why I'm asking for help. 1 1 Quote
mikromundo Posted October 14, 2023 Posted October 14, 2023 I have showmask enabled in a unitreemenu. How could I do it so that when I click on a SUBMENU the showmask is not displayed? In other words, I want the showmask to be shown only when clicking on an option without submenus. Quote
Sherzod Posted October 16, 2023 Posted October 16, 2023 On 10/14/2023 at 9:18 PM, mikromundo said: I have showmask enabled in a unitreemenu. How could I do it so that when I click on a SUBMENU the showmask is not displayed? In other words, I want the showmask to be shown only when clicking on an option without submenus. If possible, make a simple testcase to check. Quote
picyka Posted October 25, 2023 Posted October 25, 2023 I'm also having freezes, in my case it's a frame with a grid, the mask is on the grid, several times it freezes and remains frozen for a few seconds, until released Quote
picyka Posted October 25, 2023 Posted October 25, 2023 @Farshad Mohajeri Do you expect any improvement in these situations? Quote
picyka Posted March 13 Posted March 13 Was there any solution for this? Using ShowMask doesn't seem to be a good option, sometimes it generates ajax errors. 1 Quote
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.