LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.
So I saw one example (somewhere) that showed executing a script and launching the LiveCode dialog. When I try to run the following, I get "Hello" in a dialog followed by an error.
OnPaint() is just where you draw the control. OnCreate() is where you can initialize variables, start timers, etc. Then you respond to events using handlers like OnMouseUp(), OnMouseDown(), etc.
Scott - I just came across the OnOpen() handler as well. That is probably a better place to start timers. I'm using it to calculate the width of text in a widget so I can access the width in a preOpenStack handler. Previously I was just calculating the width in OnPaint.
OnCreate - initialize script local variables with default values.
OnLoad - load up saved data
OnOpen - Schedule timers, determine bounds of controls, etc. For example, if you want to get the equivalent of the formattedWidth of a widget you would need to compute that in OnOpen if you wanted to access it in a preOpenStack handler.
OnPaint - draw to screen.
"OnLoad" is called when the stack containing the widget is loaded. It is responsible for setting all the widget properties back to the values they were at save time, using an array that the widget's OnSave handler created when the stack was saved.
One other thing worth noting is that we've added a restriction to the "execute script" call - it is only usable in a small number of event handlers as, for example, using it in OnPaint will cause problems due to re-entrancy if the script causes any changes to the outside world.