add a delegate to detect button

add a delegate to detect button