2D Toolkit Forum

2D Toolkit => Support => Topic started by: test84 on March 01, 2014, 10:12:48 pm

Title: Can we have control before a toggle button changes state?
Post by: test84 on March 01, 2014, 10:12:48 pm
Hi,

Is there any even that is fired before a toggle contro's IsOn state changes?

What I want is to have some control when player presses a toggle button control but before it actually toggles it, I want to cancel the toggle based on some criteria.

In other words, If you press a toggle button, I want to catch that event, do some checks and if it's valid, let the toggle button change it's state and if the calculations return false, I show an overlay screen and toggle button should not have changed it's state.

Is there like a click or something that toggle button has that help me do that?

Thanks.
Title: Re: Can we have control before a toggle button changes state?
Post by: unikronsoftware on March 02, 2014, 09:12:36 pm
Nope, but you do have the code to all of this and it isn't exactly complicated. Feel free to customise it :)