From 2a940b0f6ce13cb612d3db585aaaf3d49b95885a Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 19 Dec 2005 22:39:52 +0000 Subject: Added detachEventHandler. --- framework/TComponent.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'framework') diff --git a/framework/TComponent.php b/framework/TComponent.php index 1a4dfe6e..0282be3a 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -317,6 +317,29 @@ class TComponent $this->getEventHandlers($name)->add($handler); } + /** + * Detaches an existing event handler. + * This method is the opposite of {@link attachEventHandler}. + * @param string event name + * @param string callback the event handler to be removed + * @return boolean if the removal is successful + */ + public function detachEventHandler($name,$handler) + { + if($this->hasEventHandler($name)) + { + try + { + $this->getEventHandlers($name)->remove($handler); + return true; + } + catch(Exception $e) + { + } + } + return false; + } + /** * Raises an event. * This method represents the happening of an event and will -- cgit v1.2.3