I have a vb script which should assign a value then insert the value into an edit box to test if the the value is valid. When the invalid value is inserted via the wText method my application immediatley pops up a modal warning stating the value is invalid. The modal warning dialog has an "OK" button on it. The problem is this, once the invalid value is inserted via the wText method and the dialog pops up TestComplete 3 hangs with an hour glass for an infinite amount of time. I've tried using the .Exists method immediately after inserting the invalid value to handle the pop up warning but for some reason the new modal warning dialog has focus and will not give up focus until I manually mouse click the "OK" button.
Any idea why this is happening??
Code looks something like this …
TestedValue = 1234
w.EditBox.wText = TestedValue <-AFTER EXECUTING HERE WARNING POPUP OCCURS AND TC3 HOURGLASS
If sys.process[MyProg].window[blah, blah].window[#32777, "Warning 3.2, 2].Exists
Re: TC3 Hangs
The issue is the following: when the script is trying to assign a value to the wText property, it calls the SendMessage Win32 API function. This function doesn't return until the message is handled by the target application. However, in your case, handling the message in the tested application means showing a warning modal dialog.
As a result, the script hangs until you manually click the OK button in the warning dialog.
To solve the problem, you can input text to the edit field using the Keys function.