Close a popup dialog

Hello all,

In my add-on i inserted a popup dialog. I created a cancel button in the lay-out, but can’t figure out how to close the dialog by pressing that button.

This is the operator i created so far (just the class with standaard variables):


class CancelOperator(bpy.types.Operator):bl_idname = "error.cancel"
bl_label = "No! (press ESC)"

def execute(self, context):
[INDENT=2]#some cancel dialog action here
return {'FINISHED'}[/INDENT]

Does somebody have an idea?

Thanks in advance!

P.S. I’m aware of the fact the dialog closes automaticly when the mouse moves away or when the ESC key is pressed. But i really want this button to work, except when it’s just not possible in any way.