Page 1 of 1

Error calling controller.getWindow().hide()

PostPosted: Tue Dec 16, 2014 12:39 pm
by LXS
Hi,

when i want to close a form in dialog i use the following code to do that:

Code: Select all
controller.getWindow().hide()


But sometimes - not always - i get this error message:

Code: Select all
TypeError: Cannot call method "hide" of null


It seems that
Code: Select all
controller.getWindow()
does not return a Window all the time.

Is it better to use
Code: Select all
application.getWindow().hide()
?

If yes, what is the difference between this methods?

Thanks,
Alex

Re: Error calling controller.getWindow().hide()

PostPosted: Thu Dec 18, 2014 10:32 am
by LXS
I can't believe, that nobody closes forms in dialog :D

Re: Error calling controller.getWindow().hide()

PostPosted: Thu Dec 18, 2014 10:57 am
by Peter de Groot
Hi,

I always use a closeWindow() method, somthing like:

Code: Select all
function closeWindow($event){
       application.getWindow($event.getFormName()).hide();
}


Never any problems hiding/destroying dialogs.

Regards,

Peter

Re: Error calling controller.getWindow().hide()

PostPosted: Thu Dec 18, 2014 10:59 am
by LXS
Thanks for your reply Peter, but you use application.getWindow() and not controller.getWindow() - right?

Re: Error calling controller.getWindow().hide()

PostPosted: Thu Dec 18, 2014 11:03 am
by Peter de Groot
LXS wrote:Thanks for your reply Peter, but you use application.getWindow() and not controller.getWindow() - right?


Yes, that's right, the event passes the form name.

Regards,

Peter

Re: Error calling controller.getWindow().hide()

PostPosted: Mon Dec 22, 2014 11:37 am
by jcompagner
if controller.getWindow() doesn't return a window, then that form where that controller belongs to is not in a visible window anymore. (so the window is already hidden or destroyed)