Accessing function in window

Hi.
I’ve created my win like this:

    var dhxDlg; //global
    function SetRV(tip, id, title)
    {
        var url = "test/RVDlg.php?etc="+new Date().getTime()+"&dlg_tip="+tip+"&dlg_id="+id;
        dhxDlg= new dhtmlXWindows();
        dhxDlg.setImagePath("./imgs/");
        var RVDlg = dhxDlg.createWindow('RVDlg', 250, 100, 900, 775);
        RVDlg.denyResize();
        RVDlg.denyPark();
        RVDlg.setModal(true);
        RVDlg.button("park").hide();
        RVDlg.button("minmax1").hide();
        dhxDlg.setSkin("dhx_web");
        RVDlg.centerOnScreen();
        RVDlg.setText(title); 

        //alert(url);
        RVDlg.attachURL(url);
    }
    

Inside window I have ‘TestMe()’ dummy function which I’m trying to call from outside (let’s say index.php file), I’ve triyed your’s sugestion:

dhxDlg.window('RVDlg')._frame.contentWindow.TestMe();

but this doesn’t work, firebug says ‘TypeError: dhxDlg.window(…)._frame is undefined’. If I do it like this: dhxDlg.window('RVDlg').vs.def._frame.contentWindow.TestMe(); it runs fine !?
What’s this ...vs.def... , and I’m not sure if this is the propper way. How else can I access ma function?
Thanks in advance.

Hi
First of all you must be sure that you try to call this function after window is loaded. It seem like you have exactly this issue (based on error message)

Hi and thanks for your replay.
Yes I’m sure, in fact I’m calling it like this:

if(dhxDlg.window('RVDlg').isWindow)
{
     dhxDlg.window('RVDlg').vs.def._frame.contentWindow.TestMe();
}

In this case we need a direct link to your project or completed demo to inspect it
docs.dhtmlx.com/doku.php?id=othe … leted_demo

Will do so, but can’t do it today because it’s large project so i’ll need to create small example.

Ok, just when you have time. :slight_smile:

Hi, I’ve put together a small demo, please read ‘ReadMe.txt’ file which contains description.
Hope to hear from you. Thanks.
Demo.zip (74 KB)

1th question from ReadMe.txt file:
Method close() unloads ONE current window (in you case w1 or w2).
Method unload() it is destructor for Global dhxWindow object (in your case dhxWindow or dhxWindow2). You need to use only
dhxWindow2.unload();
Int mast be ONLY ONE Global dhxWindow object on the page.
If you need to destruct all the window, you need to use unload() for global one
If you need to destruct only one window, apply close() for it

2th question from ReadMe.txt file:
There is a method getFrame(), you need the next:
dhxWindow1.window(‘w1’).getFrame().contentWindow.TestMe();