## wb_set_handler

int wb_set_handler (int window, mixed fn_handler)

Assigns the callback function fn_handler to window. The handler function may be a regular PHP function or class method that is used to process events for this particular window. wb_set_handler() must be called whenever the window needs to process messages and events from its controls.

To specify a function as the handler, pass the function name in fn_handler. If the handler is a class method, fn_handler must be an array which first element is the name of the object and the second one is the method name.

For additional information, see callback functions and window handlers.

# Sample

`$mainwin = wb_create_window(NULL, 100, "", 320, 240); wb_set_handler($mainwin, "process_main");` `// Place other initialization code here` `function process_main($window, $id, $ctrl=0, $param1=0, $param2=0, $param3=0) { switch($id) { case ID_ABOUT: wb_message_box($window, "Test application"); break; case IDCLOSE: wb_destroy_window($window); break; } }`

# See also

wb_create_window
Window functions
Callback functions and window handlers
Window messages and events