Micro Focus QTP (UFT) Forums
FireEvent Method on WebEdit - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: FireEvent Method on WebEdit (/Thread-FireEvent-Method-on-WebEdit)



FireEvent Method on WebEdit - manjunath.rgl - 08-25-2010

Hi,

My Requirement is as follows...

I have a grid with a webedit to filter the grid. I can filter the grid in two ways, enter the text in webedit and click on Image Filter alternatively I can enter the text in webedit and pass keyboard events like 'OnKeyDown','OnKeyUp','OnKeyPress' etc.,
We are using the second method and it worked in my system. Now when the same script is run on different machine the filtered text entered in webedit vanishes as soon as 'OnKeyUp' Event is fired and grid will be filtered for "" resulting in all the grid records being displayed irrespective of filter. The Code is as follows...

Code:
TempIndex = -1
FilterTextBoxIndex  = 1
Events = "OnKeyUP|OnKeyDown|OnKeyPress"
Set FilterGridObject = ChildWin_GPC2.ChildObjects(TexBoxObj)
For i = 0 to FilterGridObject.Count - 1
    If FilterGridObject(i).getroproperty("x") > 0 Then
        TempIndex = TempIndex + 1
        If FilterTextBoxIndex = TempIndex Then
            FilterGridObject(i).Set strValue
            FilterGridObject(i).Click
            wait(2)
            EntireEventValArray = Split(Events,"|")
            For EventAr = 0 to Ubound(EntireEventValArray)
            FilterGridObject(i).FireEvent EntireEventValArray(EventAr)
                Next
        End If
    End If
Next

As Soon as 'OnKeyUP' Event is fired the value set for the text box vanishes in some machines. Kindly hep me on this. Browser used is IE7