How do I get a button inside a window to close the window?

In the given Windows sample “Attach Object and Adjust”
[url][/url] how would one code the cancel button to close the window? I have the submit button working submitting the form, but how do I get the cancel button to work?

You may call w1.close() on button click.

Thank you, that works great!