Forum Discussion
This sounds like an additional check, then. The check I mentioned before checks, first, if the object exists. The error you were reporting earlier was that the object did not exist and, therefore, you were getting errors on the "VisibleOnScreen" check.
Now, we have a new scenario. The object has passed the initial test to see if it exists. Now that we know it exists (is resident in memory), we want to see if it's visible. Is this a correct assessment of the current problem?
If so, I would add a nested "else" clause under your first one to check for visibility. I would actually use the "Visible" property, not the "VisibleOnScreen" property. Technically, they are two different things. So, if the object DOES exist, we'll flip down to the "else" clause and check to see if it's visible. If it's not visible, we'll execute some code in order to refresh the object or otherwise re-activate it in the application.
Hi
It's OK. My code after your help.
procedure clientes; var vezes; begin vezes := 1; for vezes := 1 to 3 do begin if not(Aliases.control.WaitAliasChild('Clientes', 500).Exists) then begin Aliases.control.Principal.Keys('~c'); Aliases.control.Principal.ToolBar1.PopupMenu.Click('[0]'); Aliases.control.Principal.ToolBar1.PopupMenu.Click('[0]'); Log.Message('Essa é a ' + IntToStr(vezes) + 'ª tentativa de acesso ao menu.') end else if not Aliases.control.Clientes.Visible then begin Aliases.control.Principal.Keys('~c'); Aliases.control.Principal.ToolBar1.PopupMenu.Click('[0]'); Aliases.control.Principal.ToolBar1.PopupMenu.Click('[0]'); Log.Message('Essa é a ' + IntToStr(vezes) + 'ª tentativa de acesso ao menu. Janela ja existia na memoria.') end end end;
Thank you.