Call back command when I need to quit

Hi
What is call back command when i need to press like a OK button or cancel button. after finish call back routine for those two commandm i need to quit from dialog (i.e. GUI) and quit from the script. what should I do.