This thread might help. If you don't understand how to use onAction events I'll be happy to explain them. I'd try to avoid catchEvent (which that script uses) until you're a bit more experienced with GUIs. If you'd like a more conventional example, try
this (but whatever you do, do NOT style your code like that).