Getting first "click" from a GUI.Toggle?

For visual reasons, I need to use a GUI.Toggle (instead of a GUI.Button) to trigger an event that happens just once. What I’m using is this:

	myBool = GUI.Toggle (Rect (129, 22, 31, 30), myBool, myIcon);		
	if (GUI.changed  myBool == true) {
		do something;
	}

This works as long as the user clicks anywhere but on a GUI element. The problem is when the user clicks anywhere in the GUI. I just want it to happen when this particular GUI.Toggle is clicked. Any ideas?

Wouldn’t it be better if you used a GUI.Button and used guistyles to make it look like a toggle?

–Eric

Hmmm… I thought about that but couldn’t figure out how to do it. Guess I’ll give that another look.

As for your particular question, GUI.changed is not readonly - you can set it to false just before the toggle code.

Wow, that was a clever solution. Works like a champ, thanks very much!