Creating Event Handlers for TestComplete Events
Hello,
I was following the link: https://support.smartbear.com/testcomplete/docs/testing-with/advanced/handling-events/creating-handlers/for-testcomplete-events.html, for creating an event handeler for unexpected windows in my tests, but i cannot figure out how to define a messageText in the logParams. I am sending you the code i am using in my script and had copied from Smartbear support web site.
I am sending a screenshoot from the error i get,
Looking forward for your response,
Thanks in advance.
procedure ProjectEvents1_OnUnexpectedWindow(Sender; Window; LogParams);
begin
Log.Picture(Sys.Desktop, 'Image of the whole screen');
LogParams.MessageText :='ok';
// You can use the following line to cancel
// posting of the default TestComplete messages
// LogParams.Locked := True;
end;
That's not how event handlers are triggered. An event is something that automatically happens by TestComplete. The script code you created will be triggered when the event occurs. Firing it manually as you have will not work as it is dependant upon particular objects being present. When the event is fired, the LogParams object is created with all the proper fields and methods.
If you followed the steps for generating the event and linking it, then your code should work simply when the event is triggered.