Forum Discussion

lherry's avatar
lherry
Contributor
7 days ago

Shared user form between projects and event management

Hi all,

I'm using a form that is shared between several projects. 
This form has 2 event handlers and I'm encountering a problem when executing it on the different projects.

Assigning the event handler in the form works on the first project, but fails on the next.
It's logical and due to the GUID attached between the form control and the event handler, which, as its name suggests, is unique to the project.

To “get around” this technical constraint, I'd like to assign this handler dynamically from an initialization method, but I can't find any property that allows me to do so.

Is there a solution to my problem other than duplicating my form file for each project?

Thank you in advance for your help.

  • lherry's avatar
    lherry
    Contributor

    Your idea seems a good one, however, impossible to use the Runner.CallMethod().
    It only works for project's scripts and extension scripts, not for exchanges between projects.

    I've just done a test: I've created a ProjectSuite containing ProjectA and ProjectB.
    I'm trying to call the ProjectB.MethodB() from ProjectA.MethodA() but no solution seems to work.

    Unless the Runner.CallMethod() function has a hidden syntax that allows you to call a script from another project?

    Thanks in advance for any help

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    The GUID references are internal use to TestComplete only. They can't be generated manually, well, unless you do a search and replace outside of TC, e.g. using Notepad++.

    If you create a separate project within your project suite and call it Common. Define your name mapping, events etc for your form. You should then be able to call this from other projects; you will have to implement a callback routine so that it triggers when an event is raised.