Hide the close button?

Hi all,

This must have been brought up earlier but I could not find it…
Is it possible to hide the close button on a window that I bring up by application.createWindow(); and then showing it?
I mean the red cross sign in the top right of the window frame.

The problem I’m having is I need to run the code that destroys the form in that window when the user closes it.
But I cannot do solutionModel.removeForm() before I hide it.
So I cannot put my destructive (:p) code in onHide.
Not sure if I can have some sort of a callback method that would run after onHide returns true…
Any advice on that? I thought that if I disable the ‘close’ button on the window itself and have my own button that would close the form window and then destroy it.

Cheers,
Maria

Maria, you can prevent the close button from closing the form, by using a form variable.

than make an onHide method:

function onHide()
{
     if(fv_myvariable == false) {
          return false
     }
}

than create a button, where you also want todo hide/destroy your window:

function myHideButton()
{
     fv_myvariable = true
     //do your stuff here
     controller.getWindow().hide()
}

be sure to set the fv_variable in the onShow always back to false…
Hope this helps

Hi Maria,

You can take a look at how I do it in the Dialog module. I use the scheduler plugin as a callback to destroy the form.
This way there are no references to the form and no events still running.

Hope this helps.

Harjo:
Maria, you can prevent the close button from closing the form, by using a form variable.

than make an onHide method:

function onHide()

{
if(fv_myvariable == false) {
return false
}
}




than create a button, where you also want todo hide/destroy your window:



function myHideButton()
{
fv_myvariable = true
//do your stuff here
controller.getWindow().hide()
}




be sure to set the fv_variable in the onShow always back to false.....
Hope this helps

Hi Harjo,

Thank you for the suggestion. What I’m worried about is that the users will click the ‘close’ button of the window and get annoyed that it doesn’t do anything.
Besides, having two ways of closing a window (the native window button and my one) sounds like a bit of doubling, even though one of them will not work intentionally.

Cheers,
Maria

ROCLASI:
Hi Maria,

You can take a look at how I do it in the Dialog module. I use the scheduler plugin as a callback to destroy the form.
This way there are no references to the form and no events still running.

Hope this helps.

Works like a charm, Robert :D
Nice solution. Thanks a lot!

Cheers,
Maria