Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating an object via Function Library
#4
Solved: 11 Years, 3 Months, 4 Weeks ago
Thanks, I tried using your code as reference, like so:

Code from action, Flight_NewSale:
Code:
Public txtName
...
Set txtName = createObject("WinEdit", "Arrival Time:")

Code from function library, createObject:
Code:
Public objInst
...
Public Function createObject(typeObject, valProperty)
    Dim objInst ' as Object
    Set objInst = Description.Create()

    Select Case typeObject
        Case "WinEdit":
            objInst("Class Name").Value = "WinEdit"
            objInst("attached text").Value = valProperty
        Case "WinButton":
            objInst("Class Name").Value = "WinButton"
            objInst("text").Value = valProperty
    End Select

    Set createObject = objInst
End Function

But I get this error: ActiveX component can't create object: 'WinEdit':
Code:
Set txtName = createObject("WinEdit", "Arrival Time:")

When I check the values of the objects in watch, it says there that both txtName and objInst are empty. Since I'm really new to QTP, may I just confirm, are the codes you posted above both located in the function library (or both located in the action script), or are they from different locations (the line:

Code:
Set vo_ResDesc=createDescription("Link",DataTable("REScreateexport",dtGlobalSheet))

is found only in the action script and the function createDescription is located at the function library)?
in the action script, and the rest of the function createDescription in the


Thanks, tip about the micclass has been noted. However, I do know how to create descriptions of objects. What I want to know is, if I can create the descriptions of the objects using a function from the function library.
Reply


Messages In This Thread
RE: Creating an object via Function Library - by riechan - 06-20-2012, 07:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling a function in a Test Script from a function library anupam4j 3 6,127 06-26-2015, 12:31 AM
Last Post: babu123
  Using QTP features in Function library TurtleRock 0 1,737 01-30-2014, 06:02 PM
Last Post: TurtleRock
  QTP is not recognizing Function Library Path associated to the test AshokReddy 2 4,105 12-19-2013, 01:59 PM
Last Post: AshokReddy
  Accessing Environment variable value in Library file vishruth143 1 2,571 09-07-2013, 05:11 AM
Last Post: jacosta
  Creating Random String SomeIntern 0 5,082 08-21-2013, 09:10 PM
Last Post: SomeIntern

Forum Jump:


Users browsing this thread: 2 Guest(s)