View Single Post
  #6  
Old 01-07-2010, 10:22 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Liberated View Post
What doe catchEvent() do?
I was already wondering if there wasn't an easier way btw.
catchevent(str, str, str) - adds an event handler for the specified object name and event, third parameter is the name of the function which receives the event (first parameter of the event will be the object for which the event occured)
http://wiki.graal.net/index.php/Crea...ient/TGraalVar

PHP Code:
//in button creation
catchEvent(this"onAction""buttonPressed");

//later
function buttonPressed(obj) { //obj is the object caught
  //stuff

Doing simple checks (probably easiest to use obj.text) inside buttonPressed() will determine what to do.

Example:
PHP Code:
if (obj.text in |09|) {
  
this.number1 @= obj.text;

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote