Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: WebSeed on October 13, 2013, 03:31:21 AM

Title: UIButtonKeyBinding and UIImageButton.isEnabled
Post by: WebSeed on October 13, 2013, 03:31:21 AM
Hi,

I have a UIImageButton with a UIButtonKeyBinding. When I disable the button (isEnabled = false), I can no longer trigger a button press with a mouse / touch event but the key will still trigger the press event (and the sprite changes from disabled to pressed). I guess this is because only the button's collider is disabled. Is this intended behaviour?
Title: Re: UIButtonKeyBinding and UIImageButton.isEnabled
Post by: ArenMook on October 13, 2013, 10:10:18 AM
It's because UIButtonKeyBinding doesn't go by UIButton component. It just sends an OnClick message inside (just check the code). If you want it to respect the button's state, you should add code for it. Best place to do it is inside your own function that you have listening for the OnClick event. Check the button state there.