Hi,
rmnrdi:
You did not mention it, but considering the fact that you are posting to the Desktop Testing section, I assume that you are working with the native Windows application.
As it was already adviced by karkadil, OnUnexpectedWindow event is your way to go. This event is triggered when the target window or control cannot be activated because it is blocked by some other modal or system modal window. The above means that the event will be triggered only if test code attempts to activate some window or put focus to some control. The event will not be triggered if test code gets or sets value of some control's property or calls some control's method.
Thus, the generic solution for your case might be like this:
-- Try to activate control's parent window by calling <window>.Activate() method before interacting with the window's control;
-- If the window is blocked by some modal window, then the OnUnexpectedWindow() event will be triggered and your test code will be able to handle this window;
-- Call <control>.Click() or <control>.Focus() method to put the inlut focus to the required control and proceed as required.
P.S. If you are testing web application, then another approach is required because HTML cannot display modal HTML window. (alert() function displays not HTML, but native modal window that canbe handled as described previously.) In case of web application, you need to create a while loop and within this loop search for either the target control or the HTML-emulated popup. If control is found, then this means that the popup was not displayed and the code may exit the loop and proceed. If popup is found, then test code can handle it and continue in a loop until all popups are processed and the sought for control is found.
P.P.S.
sanc74: This is TestComplete's forum (and section about native desktop applications testing) and TestComplete has very little in common with Selenium and does not use WebDriver at all.