Close modal dialog window from webcomponent ( 7.4.6 )

Hi to all,
i have a problem when closing a modal-dialog window.

I create a modal dialog in this way

function openModalDialog ( form, windowName ) {
    var dlg = application.createWindow( (windowName ? windowName : application.getUUID().toString()) ,JSWindow.MODAL_DIALOG );
    dlg.undecorated = true;
    if ( form.setWindowName && ( form.setWindowName instanceof Function ) {
        form.setWindowName( dlg.getName() )
    }
    dlg.show( form );
}

If a close a dialog form by clicking on a button in the form all works well,

function closeModalDialog ( windowName ) {
	var thisWindow = null;
	if ( windowName ) {
		thisWindow = application.getWindow( windowName );
	}
	if ( thisWindow ) {
		thisWindow.destroy();
	}
}

function closeForm ( ) {
    scopes.UI.closeModalDialog( getWindowName() );
}

but when i call the function to close the window from my webcomponent ( using servoy 7.4.6 ) the modal window is destroyed but remain in webclient and is not possible to close it in any way

....
function callBackFromWebcomponent ( data ) {
    // do something
    closeForm();
}

function closeForm ( ) {
    scopes.UI.closeModalDialog( getWindowName() );
}

and if i try to get the window again

application.getWindow( windowName );

the function return null value
Is there a possible bug or i’m wrong something?

Thanks

What webcomponent are we talking here about?
And where is that component ? is that a component also on the form that is shown in the modal dialog?
It is hard to see what goes wrong here, but i guess some state is not set correct

For example what is in both scenario;s the currentwindow/currentcontroler? (if you print those when closing the dialog) ?

I’m sorry jcompagner, you’re right.
I made a webcomponent using svyComponent module on servoy 7.4.6.
The component is on a modal dialog window that i create with the function of the previous post.
I print the content of currentcontroller.getWindow() before and after close a window.
If i click on a button of the form to close the window i have:

JSWindow[name:mini,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=80,y=34,width=1119,height=587],title:null]
JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]

If i open again the window and call the close function from the webcomponent callback i have:

JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]
JSWindow[name:null,visible:true,destroyed:false,bounds:java.awt.Rectangle[x=0,y=0,width=1280,height=656],title:null]

So i think that the problem was at the component level, because currentcontroller not get the popup window but always the main window.

What do you think?

yes something like that is the problem. Your component doesn’t set the right active window or something like that.